-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fetch float16 and float128 with h5grove as binary using dtype=safe
#1561
Conversation
dtype=safe
dtype=safe
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
null, | ||
Infinity, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maximum finite float128 value gets converted to float64 Infinity
. I would have expected Numpy to clamp it to the maximum finite float64 value instead. 🤔
Now that I think of it, a similar thing happens with the smallest float128 value greater than 0 (the value of the float128_scalar
dataset in the sample file) => h5grove sends 0 in float64 — not the smallest float64 value greater than 0, as I would have expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maximum finite float128 value gets converted to float64 Infinity
Sounds like a safe behaviour. It would be weird to convert a finite value to another while you know it's not the same value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be weird to convert a finite value to another while you know it's not the same value.
That's exactly what happens when you cast an int64 to int32, though. Obviously inf
cannot be represented in int32, but still, in float, it's a special value... The rounding to 0 makes more sense in that regard.
I'm just asking in case the code in h5grove is wrong somehow — maybe the float128 are cast by Python before numpy can convert them properly, or something of the sort. 🤷
02f2b71
to
44dbe02
Compare
Sorry, took a while to get back to this and I would need some context to refresh my mind. Why using |
No worries! There's no When fetching float16/128 datasets with |
No description provided.