[libc-commits] [PATCH] D113710: [libc] add basic strtold implementation

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Nov 11 15:46:44 PST 2021


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


================
Comment at: libc/src/__support/str_to_float.h:402
+      1e22,
+      (long double)(1e22) * 1e1,
+      (long double)(1e22) * 1e2,
----------------
Will the literal constant 1e23L work correctly for this?


================
Comment at: libc/src/__support/str_to_float.h:409
+  static constexpr int32_t digitsInMantissa = 21;
+  static constexpr long double maxExactInt = 18446744073709551615.0;
+};
----------------
You should add the suffix -L for the constant just in case the literal is converted to double before long double. 


================
Comment at: libc/src/__support/str_to_float.h:460
+      (long double)(1e22) * 1e22,
+      (long double)(1e22) * (long double)(1e22) * 1e1,
+      (long double)(1e22) * (long double)(1e22) * 1e2,
----------------
Check if the literal 1e23L, ... work properly.


================
Comment at: libc/src/__support/str_to_float.h:468
+  static constexpr long double maxExactInt =
+      10384593717069655257060992658440191.0;
+};
----------------
Add suffix -L for the literal.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113710



More information about the libc-commits mailing list