[libc-commits] [PATCH] D150399: [libc] add options to printf decimal floats
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu May 25 15:07:41 PDT 2023
lntue added inline comments.
================
Comment at: libc/src/__support/FPUtil/dyadic_float.h:128
+ if (exponent > 0) {
+ new_mant = new_mant << exponent;
+ } else {
----------------
Use in-place `<<=` or add it to `UInt` if missing.
================
Comment at: libc/src/__support/FPUtil/dyadic_float.h:130
+ } else {
+ new_mant = new_mant >> (-exponent);
+ }
----------------
Use in-place `>>=` or add it to `UInt` if missing.
================
Comment at: libc/src/__support/float_to_string.h:144
+ constexpr cpp::UInt<INT_SIZE> MOD_SIZE =
+ (cpp::UInt<INT_SIZE>(1000000000)
+ << (CALC_SHIFT_CONST + (IDX_SIZE > 1 ? IDX_SIZE : 0)));
----------------
I'm just curious, will changing from `1000000000 * 2^(...)` to `1953125 * 2^(... + 9)` has any affect, like performance or accuracy? Same with other instances below.
================
Comment at: libc/src/__support/float_to_string.h:347
+
+ return (val % 1000000000)[0];
+ // return fast_uint_mod_1e9(val);
----------------
Use `val.div_uint32_times_pow_2(1000000000, 0)` to speed up?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150399/new/
https://reviews.llvm.org/D150399
More information about the libc-commits
mailing list