Skip to content

Commit 35ce3d5

Browse files
cleanup, adjust docs, update build systems
1 parent 2fc5943 commit 35ce3d5

File tree

4 files changed

+107
-193
lines changed

4 files changed

+107
-193
lines changed

libc/config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"doc": "Disable handling of %n in printf format string."
1414
},
1515
"LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE": {
16-
"value": true,
16+
"value": false,
1717
"doc": "Use large table for better printf long double performance."
1818
}
1919
},

libc/docs/dev/printf_behavior.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,25 @@ are not recommended to be adjusted except by persons familiar with the Printf
8787
Ryu Algorithm. Additionally they have no effect when float conversions are
8888
disabled.
8989

90+
LIBC_COPT_FLOAT_TO_STR_NO_SPECIALIZE_LD
91+
---------------------------------------
92+
This flag disables the separate long double conversion implementation. It is
93+
not based on the Ryu algorithm, instead generating the digits by
94+
multiplying/dividing the written-out number by 10^9 to get blocks. It's
95+
significantly faster than INT_CALC, only about 10x slower than MEGA_TABLE,
96+
and is small in binary size. Its downside is that it always calculates all
97+
of the digits above the decimal point, making it slightly ineffecient for %e
98+
calls with large exponents. This is the default. If this flag is not set, no
99+
other flags will change the long double behavior.
100+
90101
LIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE
91102
-------------------------------------------------
92103
When set, the float to string decimal conversion algorithm will use a larger
93104
table to accelerate long double conversions. This larger table is around 5MB of
94-
size when compiled. This flag is enabled by default in the CMake.
105+
size when compiled.
95106

96-
LIBC_COPT_FLOAT_TO_STR_USE_DYADIC_FLOAT(_LD)
97-
--------------------------------------------
107+
LIBC_COPT_FLOAT_TO_STR_USE_DYADIC_FLOAT
108+
---------------------------------------
98109
When set, the float to string decimal conversion algorithm will use dyadic
99110
floats instead of a table when performing floating point conversions. This
100111
results in ~50 digits of accuracy in the result, then zeroes for the remaining
@@ -107,8 +118,7 @@ LIBC_COPT_FLOAT_TO_STR_USE_INT_CALC
107118
When set, the float to string decimal conversion algorithm will use wide
108119
integers instead of a table when performing floating point conversions. This
109120
gives the same results as the table, but is very slow at the extreme ends of
110-
the long double range. If no flags are set this is the default behavior for
111-
long double conversions.
121+
the long double range.
112122

113123
LIBC_COPT_FLOAT_TO_STR_NO_TABLE
114124
-------------------------------

0 commit comments

Comments
 (0)