Skip to content

format(mp.mpf(0.99999), '.4f') returns '0.99999' #858

Description

@skirpichev

Should be '1.0000'.

I would guess this is related to "a hack" here:

mpmath/mpmath/libmp/libmpf.py

Lines 1519 to 1522 in 9d9029a

# Hack: if the digits are all 9s, then we will lose one dps when rounding
# up.
if all(dig == stddigits[base-1] for dig in digits[:dps+1]):
dps += 1

CC @javierelpianista

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions