[libc-commits] [libc] [llvm] [libc] Make str_to_float independent of fenv (PR #102369)

via libc-commits libc-commits at lists.llvm.org
Wed Aug 7 14:25:44 PDT 2024


================
@@ -525,10 +525,13 @@ clinger_fast_path(ExpandedFloat<T> init_num,
   FPBits result;
   T float_mantissa;
   if constexpr (cpp::is_same_v<StorageType, UInt<128>>) {
-    float_mantissa = static_cast<T>(fputil::DyadicFloat<128>(
-        Sign::POS, 0,
-        fputil::DyadicFloat<128>::MantissaType(
-            {uint64_t(mantissa), uint64_t(mantissa >> 64)})));
+    // float_mantissa = static_cast<T>(fputil::DyadicFloat<128>(
+    //     Sign::POS, 0,
+    //     fputil::DyadicFloat<128>::MantissaType(
+    //         {uint64_t(mantissa), uint64_t(mantissa >> 64)})));
+    float_mantissa = (static_cast<T>(uint64_t(mantissa)) *
+                      static_cast<T>(1ull << 32) * static_cast<T>(1ull << 32)) +
----------------
lntue wrote:

you can use `static_cast<T>(0x1.0p64)` for 2^64.

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


More information about the libc-commits mailing list