-
Notifications
You must be signed in to change notification settings - Fork 228
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
Fix f32 type conversion to be safe #350
Conversation
08dfea9
to
e210aa4
Compare
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.
Thanks for your pull request! Sorry for taking so long for the review.
I'm not sure why |
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.
Looks good to me! Can you rebase on master to get rid of the clippy lint? After that we are good to go.
b740ba7
to
5505698
Compare
Thanks again @Virviil ! |
Decoding
f32
is made usingenif_get_double
, which obviously consumes values bigger thanf32:MAX
.Then,
ret as f32
not limiting the value by it's max, either turn it to bef32:INFINITY
. This leads to confusions and even nif panics.