Skip to content

<charconv>: from_chars() incorrectly tiebreaks floats #2363

@StephanTLavavej

Description

@StephanTLavavej

Reported as DevCom-1592387 by Christopher Dannemiller:

When values are converted from string to a floating-point at the exact rounding boundary, the resulting values in the compiler and std::from_chars are incorrect. Since there are a large number of values, ~8million on the positive side, that have this problem, I have only included one example:

131071.98828125f, this should result in the floating-point value 0x47fffffe stored in hex. However, MSVC v19.29 gives 0x47ffffff. This can be explored using the following Godbolt link https://godbolt.org/z/r7Ks9GMEb. MSVC v19.28 and earlier, along with GCC and Clang, provide the correct results. This indicates that this is a regression in the compiler.

Also tracked by VSO-1441452 / AB#1441452 . We'll need to inform the UCRT and compiler when we have a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions