[libc-commits] [PATCH] D91591: [libc] Add implementations of ldexp[f|l].

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Nov 17 12:02:35 PST 2020


lntue accepted this revision.
lntue added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/utils/FPUtil/NormalFloat.h:131
       } else {
-        // TODO: Should zero with the correct sign be returned?
-        return FPBits<T>::buildNaN(1);
+        return sign ? FPBits<T>::negZero() : FPBits<T>::zero();
       }
----------------
since output's sign is always be the same as the input's sign, maybe set result.sign = sign earlier, then this branch can simply be return result?


================
Comment at: libc/utils/FPUtil/NormalFloat.h:250
     } else {
-      // TODO: Should zero with the correct sign be returned?
-      return FPBits<long double>::buildNaN(1);
+      return sign ? FPBits<long double>::negZero()
+                  : FPBits<long double>::zero();
----------------
Similar as above


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91591/new/

https://reviews.llvm.org/D91591



More information about the libc-commits mailing list