-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Data type precision problems? #5272
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
Comments
@juliantaylor @charris do you folks have any insight to provide to me here? |
I don't think you should be addressing this to the maintainers directly, this is a routine question, and I don't think you have any reason to ask Julian or Chuck specifically. I suggest you try this on the mailing list - I think your question is a request for clarification. Also, you might get some more insight by experimenting with ``set_printoptions` as you imply. |
float64 converts to a python float which is probably the reason why it prints different. float32 and float128 are numpy types. |
@juliantaylor thanks for the clarification, my assumption was that all numpy.type declarations were numpy types - the point to note about float64 being a python type is a surprise to me.. And ouch about float128 too, I thought the name (128) and it's type were the same.. Thanks for the clarification, I'll trawl through the numpy docs and educate myself a little better on this.. |
I have suggested deprecating the name float128 etc in the past, but the discussion seemed to stall. http://mail.scipy.org/pipermail/numpy-discussion/2011-October/058806.html Is it time for another iteration of that discussion? The current naming is quite clearly not helpful. |
@matthew-brett I would vote with you for a name change.. It's clearly tripped me over (at least in my understanding) and also seems to be an omission in the numpy data type docs http://docs.scipy.org/doc/numpy/user/basics.types.html (I note that as a footnote to the data type 'table' the additional platform dependent types If it's not documented, I think either remove it or rename (and document) it.. It also wasn't clear to me that numpy.float64 is a python float, rather than an internal numpy float/data type - this quirk is also not clear in the docs (linked above) - what this means (python float vs numpy float) would also be a question in which I'd be interested to know the answer.. |
Also I think the shape change you noticed is very difficult to explain:
|
@matthew-brett this shape change behavior seems to be consistent at least back to 1.7.1.. I'd certainly be interested to know why float64 is a python data type rather than a numpy internal data type.. |
It may be that float64 printing works via Python floats, but the output of
|
@matthew-brett @juliantaylor I think the rename suggestion of float80_96 (32-bit) and float80_128 (64-bit) seems like a path forward, as described at http://mail.scipy.org/pipermail/numpy-discussion/2011-October/058820.html |
@juliantaylor @charris I do realise that type renaming is a very low priority, however how would I get this assigned to a milestone 1.9.2 or 1.10? Do you folks require any more information to make this fairly trivial name change..? |
Basically what we'd need is a pull request implementing the change :-).
|
* use longdouble instead of float128 in test_write_dx_ValueError float128 doesn't exist on 32-bit arches and longdouble maps to float96 there. See also numpy/numpy#5272 . * fixes issue #44.
As of NumPy 1.24.0, we get:
I believe this is no longer relevant so I am closing - feel free to reopen if there are still pending issues. See also #10288 for the float128 name discussion. |
Is the difference in shape between |
Oops, good catch. |
Hi folks I've just been investigating some type conversion and came across what appears unusual behaviour to me - I would have expected these statements to more faithfully print the values at their respective precisions:
I haven't investigated playing around with
numpy.set_printoptions(precision=2)
The text was updated successfully, but these errors were encountered: