Skip to content

Floating point __str__ #6908

Closed
Closed
@anntzer

Description

@anntzer

Related to (but different from) #6136: float64.__str__ can truncate different floats to the same string, even when printoptions is set to a high enough precision:

In [12]: np.set_printoptions(precision=1000)

In [13]: x = np.float64(0.20000000000000004)

In [14]: x > np.float64(.2)
Out[14]: True

In [15]: str(x)
Out[15]: '0.2' # oops

Note that repr(x) correctly gives '0.20000000000000004'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions