[libc-commits] [PATCH] D157156: [libc] Add get_explicit_exponent to fpbits

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Aug 14 13:36:39 PDT 2023


michaelrj added inline comments.


================
Comment at: libc/src/__support/FPUtil/x86_64/LongDoubleBits.h:150
+    if (is_zero()) {
+      return 0;
+    } else if (unbiased_exp == 0) {
----------------
lntue wrote:
> In most of the conventions for floating point exponents, zeros are often grouped together with denormal numbers.  Unless it's used in more places, do you think the logic that requires different ways of handling exponents of zeros can be put locally to those functions?
We can handle subnormals and zero in the individual places, that's what I was doing before, but I added this function because I realized it was repeated. 

Regardless of if we add the new function, we should keep the change for long double `get_exponent` because otherwise it behaves differently from other float types.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157156



More information about the libc-commits mailing list