[libc-commits] [PATCH] D150399: [libc] add options to printf decimal floats
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu May 25 15:59:30 PDT 2023
michaelrj added inline comments.
================
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)));
----------------
lntue wrote:
> 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.
This number is constexpr, so there should be no change.
================
Comment at: libc/src/__support/float_to_string.h:603-608
+ // const int idx = -exponent / IDX_SIZE;
+ // constexpr int idx_min = (IDX_SIZE / 4) + 1;
+ // if (idx < idx_min) {
+ // return 0;
+ // }
+ // return static_cast<size_t>(idx - idx_min) / 2;
----------------
lntue wrote:
> Are those still relevant?
I need to see if I can fix their calculations to make them work, but they should speed up the int mode.
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