Conversation
Handle 0x / 0b when width is equal to string size (issue mpaland#50): printf("%#4x", 0x1234); -> "0x1234" Do not print # prefix if it does not fit into PRINTF_NTOA_BUFFER_SIZE %#<prec>o is implemented as in libc: - printf("%#0o", 0); does output octal prefix ("0") - printf("%#3o", 1); printf "001" - padding zero is used as octal prefix (issue mpaland#53) Left padding and precision is handled correctly (issue mpaland#49): - printf("%-10.6d", 1024); -> "001024 "
Fixes issue mpaland#51 - fractional part may overflow in round-to-even part Rounding is still inexact, some numbers are rounded wrong way
printf("%#.0f", 1) -> "1."
Old code did use -308 as exponent for 0.0, now value is printed with zero exponent
- %g precision is number of significant digits. Default %g precision
shall be honored when printing as %f
printf("%g", 123.4567); -> "123.457"
- %g prints zero correctly (except for trailing zeroes)
printf("%g", 0); -> "0.0"
- %g shall switch to %f if supplied value fits into specified precision
printf("%.8g", 12345678); -> "12345678"
Negative value passed by "%.*" shall be taken as if no precision was specified
uses _out_pad, removes some unnecessary tests (length of string to print is known)
Signed overflow is undefined in C, this was causing problem when printing INT_MIN (gcc sign-extended value first, so 2^64-INT_MIN got printed)
Codecov Report
@@ Coverage Diff @@
## master #60 +/- ##
==========================================
- Coverage 100% 98.62% -1.38%
==========================================
Files 1 1
Lines 359 363 +4
==========================================
- Hits 359 358 -1
- Misses 0 5 +5
Continue to review full report at Codecov.
|
|
Calling *out for each character is costly. Consider sprintf functionality. you call *out for every character only to do: if (a < b) a[i] = c; Lot of overhead for a few instructions. |
|
@axiomlegend : |
Apply some changes to existing code. Split into separate commits with comments