https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110860

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:559341b5b5a30448362f3f205cd1bf043a919945

commit r13-7722-g559341b5b5a30448362f3f205cd1bf043a919945
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Fri Aug 11 18:10:29 2023 +0100

    libstdc++: Avoid problematic use of log10 in std::format [PR110860]

    If abs(__v) is smaller than one, the result will be of the
    form 0.xxxxx. It is only if the magnitude is large that more digits
    are needed before the decimal dot.

    This uses frexp instead of log10 which should be less expensive
    and have sufficient precision for the desired purpose.

    It removes the problematic cases where log10 will be negative or not
    fit in an int.

    Signed-off-by: Paul Dreik <gccpatc...@pauldreik.se>

    libstdc++-v3/ChangeLog:

            PR libstdc++/110860
            * include/std/format (__formatter_fp::format): Use frexp instead
            of log10.

    (cherry picked from commit 2d2b05f0691799f03062bf5c436462f14cad3e7c)

Reply via email to