You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix rounding cases for fixed-width printing in ryu routines
Fixes#40303. When printing values to fixed widths through the
`Ryu.writefixed` or `Ryu.writeexp` routines, we have a "cleanup" section
after a value has been printed to see if it needs to be rounded given
the input precision and width. The core issue was the terminating
condition: it previously only checked if we were at the start of a
buffer or had encountered the `'-'` character. Via Printf formatting,
however, it also allows specifying the `'+'` and `' '` characters to
preceed a formatted number. Hence, in the OP, the `'1'` character was
getting "rounded" up to the `','` character. The fix here is correctly
checking if the `plus` or `space` options were passed to the routine and
if so, include those in our rounding termination check. The original
issue only reported the "plus" case for the `f` format specifier, but
the same bug affects the `e` format specifier and the "space" option.
(cherry picked from commit fcf6779)
0 commit comments