https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110860
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:9e33d71834416b7eddadae2b0f68e85f04cd0c7f commit r14-3159-g9e33d71834416b7eddadae2b0f68e85f04cd0c7f Author: Jonathan Wakely <jwak...@redhat.com> Date: Fri Aug 11 18:10:29 2023 +0100 libstdc++: Do not call log10(0.0) in std::format [PR110860] Calling log10(0.0) returns -inf which has undefined behaviour when converted to an integer. We only need to use log10 for large values anyway. If the value is zero then the larger buffer is only needed due to a large precision, so we don't need to use log10 to estimate the number of digits for the significand. libstdc++-v3/ChangeLog: PR libstdc++/110860 * include/std/format (__formatter_fp::format): Do not call log10 with zero values.