[libc] add printf auto float conversion
authorMichael Jones <michaelrj@google.com>
Mon, 23 Jan 2023 23:11:22 +0000 (15:11 -0800)
committerMichael Jones <michaelrj@google.com>
Fri, 3 Feb 2023 23:17:37 +0000 (15:17 -0800)
commit173d50235fa3c5b028fa3c8efa5beec56b752e75
tree7e435a3892f95fd6926a6ed5e11cab22de17c868
parent223e99fb698dd63b5bb9266e11c2582261e05ad9
[libc] add printf auto float conversion

This patch adds the final conversion to printf, %g. This is a floating
point conversion that selects automatically between the %e and %f
formats based on the precision requested and resulting exponent.
Additionally it trims trailing zeroes. With this done all that's left
for finishing printf is adding long double support to the decimal float
conversions.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D143006
libc/src/__support/float_to_string.h
libc/src/stdio/printf_core/converter.cpp
libc/src/stdio/printf_core/converter_atlas.h
libc/src/stdio/printf_core/float_dec_converter.h
libc/test/src/stdio/sprintf_test.cpp