Skip to content
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

np.float_ or np.double ? #394

Open
dsarrut opened this issue Apr 23, 2024 · 2 comments
Open

np.float_ or np.double ? #394

dsarrut opened this issue Apr 23, 2024 · 2 comments

Comments

@dsarrut
Copy link
Contributor

dsarrut commented Apr 23, 2024

in opengate/geometry/utility.py”
Maybe “np.float_” should be “np.double”.
Unsure if related to numpy 2.0 ?

@tbaudier
Copy link
Contributor

For the moment numpy is a rc version for version 2. ITK and pybind still have problem with that version.
Check this commit:
0036491

@BishopWolf
Copy link

BishopWolf commented Apr 30, 2024

You can test the following

import numpy as np

print(np.finfo(np.longdouble))
print(np.finfo(np.double))
print(np.finfo(np.float_))

you will get:

  • longdouble is equivalent to float64 on Windows but different in NIX
  • double is just the Python API “C-like” name of float64
  • float is just the default float for most systems which it's just float64 but can be different (especially for ARM based machines where is equivalent to float32)

Therefore, float shall be replaced by float64 if you want 64 bit precision at least, otherwise it's safe to be used
Source: https://numpy.org/devdocs/user/basics.types.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants