[libc-commits] [PATCH] D115280: [libc] add modified Eisel-Lemire for long doubles
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Dec 9 06:56:10 PST 2021
lntue added inline comments.
================
Comment at: libc/src/__support/str_to_float.h:253
+ (fputil::FloatProperties<long double>::MANTISSA_WIDTH + 3));
+ exp2 -= 1 ^ msb; // same as !msb
+
----------------
michaelrj wrote:
> lntue wrote:
> > I'm not sure if I understand the comment here.
> `msb` is just the most significant bit of `final_approx_upper` (as assigned on line 248), so `1 ^ msb` is equivalent to `!msb`
Nvm, I was confused because in line 248, msb was right shifted by (BITS_IN_MANTISSA - 1), and I thought that BITS_IN_MANTISSA was the mantissa length, which might lead to msb > 1, and hence 1 ^ msb is not the same as !msb. But actually, BITS_IN_MANTISSA = 128, and so msb is either 0 or 1, and thus 1 ^ msb = 1 - msb.
================
Comment at: libc/test/src/__support/str_to_float_test.cpp:293
+}
+#else
+#endif
----------------
Is there any test for this #else clause?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115280/new/
https://reviews.llvm.org/D115280
More information about the libc-commits
mailing list