Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gerritholl opened this issue Jan 30, 2017 · 1 comment
Closed

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

gerritholl opened this issue Jan 30, 2017 · 1 comment

Comments

@gerritholl
Copy link
Contributor

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.

@seberg
Copy link
Member

seberg commented May 20, 2020

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)

@seberg seberg closed this as completed May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants