[libc-commits] [libc] [libc][math][c23] Add MPFR unit tests for {ceil, floor, round, roundeven, trunc}f16 (PR #94383)

via libc-commits libc-commits at lists.llvm.org
Wed Jun 5 08:19:17 PDT 2024


================
@@ -529,8 +543,14 @@ class MPFRNumber {
     // If the control reaches here, it means that this number and input are
     // of the same sign but different exponent. In such a case, ULP error is
     // calculated as sum of two parts.
-    thisAsT = std::abs(thisAsT);
-    input = std::abs(input);
+#ifdef LIBC_TYPES_HAS_FLOAT16
+    // TODO: This will no longer be needed once std::abs supports float16.
----------------
lntue wrote:

Or you can just do:
```
  thisAsT = FPBits<T>(thisAsT).set_sign(Sign::POS).get_val();
```

https://github.com/llvm/llvm-project/pull/94383


More information about the libc-commits mailing list