[libc-commits] [PATCH] D80779: [libc] Add implementations of round and roundf.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jun 9 23:06:04 PDT 2020


sivachandra marked an inline comment as done.
sivachandra added inline comments.


================
Comment at: libc/utils/FPUtil/FloatOperations.h:236-242
+  if (exponent == -1) {
+    // Absolute value of x is greater than equal to 0.5 but less than 1.
+    if (isNeg)
+      return T(-1.0);
+    else
+      return T(1.0);
+  }
----------------
sivachandra wrote:
> asteinhauser wrote:
> > Is this necessary?
> After line 250, we want `exponent` to be less than mantissa width, but greater than 0. So, we handle these two special cases of -1 and -2 separately.
Actually, `exponent` is greater than **or equal to** zero and less than mantissa width after line 250.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80779





More information about the libc-commits mailing list