Skip to content

float128(0).item() returns numpy.float128 #8547

Closed

Description

@gerritholl

float128 types cannot be represented in native Python. The conversion method .item() returns a numpy.float128, contrary to documentation and to the behaviour for all other dtypes:

In [307]: type(float128(0).item())
Out[307]: numpy.float128

Not sure what the right approach here is; for the other dtypes that cannot be represented natively, I don't like the approach either.

Activity

  1. seberg commented on May 20, 2020

    @seberg
    Member

    I think this is the best approach since there is no safe converesion, and you could use float(...) otherwise. Yes, its a bit strange, but I think raising an error is worse...

    (We discussed this briefly on the triage meeting)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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