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
The append_constexpr() overload for floating point numbers incorrectly computes the number of digits required to print the float, resulting in some characters allocated in the temporary buffer not being written over. Since the temporary buffer is zero-initialised, these characters turn into null terminators.
When printed as a std::string_view (the default in snitch), the full number will be printed, but with a non-printable null character embedded in the middle of the string. When printed as a C string, the number is truncated before the exponent.
This only happens for a specific range of exponents: e-84 to e-99.
Note: this was spotted when running the snitch float-to-string code through the dtoa-benchmark, which includes some correctness checks. For fun, here was the result:
The
append_constexpr()
overload for floating point numbers incorrectly computes the number of digits required to print the float, resulting in some characters allocated in the temporary buffer not being written over. Since the temporary buffer is zero-initialised, these characters turn into null terminators.When printed as a
std::string_view
(the default in snitch), the full number will be printed, but with a non-printable null character embedded in the middle of the string. When printed as a C string, the number is truncated before the exponent.This only happens for a specific range of exponents:
e-84
toe-99
.Note: this was spotted when running the snitch float-to-string code through the dtoa-benchmark, which includes some correctness checks. For fun, here was the result:
The correctness checks still spotted a few roundtrip issues, which are acceptable (only last digit is incorrect):
The text was updated successfully, but these errors were encountered: