Skip to content

<xlocmon>: "drop 10 zeros" logic is imprecise #770

@StephanTLavavej

Description

@StephanTLavavej

money_put::do_put contains:

STL/stl/inc/xlocmon

Lines 676 to 678 in f0f0b55

for (_Exp = 0; 1e35 <= _Val && _Exp < 5000; _Exp += 10) {
_Val /= 1e10; // drop 10 zeros before decimal point
}

Like almost all of our pre-charconv floating-point formatting, I believe that this is incorrect - dividing by a power of 10 isn't an exact operation.

This probably isn't a significant issue in practice (as few people have more than 10^35 units of money, although one can dream).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions