[libc-commits] [PATCH] D79278: [libc] Fix how math results are compared with MPFR results.

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 5 23:57:36 PDT 2020


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


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:29
+
+  static constexpr uint32_t mantissaWidth = 23;
+  static constexpr uint32_t signMask = 0x7FFFFFFFU;
----------------
Is there any way to identify the floating point standard being used? Is IEEE 754 just used everywhere?


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:30
+  static constexpr uint32_t mantissaWidth = 23;
+  static constexpr uint32_t signMask = 0x7FFFFFFFU;
+  static constexpr uint32_t exponentOffset = 127;
----------------
Does it make semantic sense for `signMask`'s type to be `BitsType`?


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:56
+  int e = (bits >> Properties::mantissaWidth); // Shift out the mantissa.
+  e -= Properties::exponentOffset;             // Zero adjust
+  return e;
----------------
Period after comment.


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:192
   MPFRNumber mpfrResult(op, input);
   MPFRNumber mpfrInput(input);
   MPFRNumber mpfrLibcResult(libcResult);
----------------
I missed this before, but is this being used?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79278





More information about the libc-commits mailing list