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

converting from f64 nan produces infinity if only lower mantissa bits are nonzero #5

Closed
tspiteri opened this issue Jan 8, 2018 · 0 comments

Comments

@tspiteri
Copy link
Contributor

tspiteri commented Jan 8, 2018

The f64 obtained from transmuting 0x7ff0_0000_0000_0001u64 is NaN, as it has all exponent bits set and has one bit set in the mantissa. The current conversion function from f64 always discards the least significant 32 bits, so it converts this into infinity instead of NaN.

Also, for both the f32 and f64 conversion functions, the sign of a converted NaN is independent of the source, unlike the primitive conversions where the sign bit is retained when converting say from an f64 NaN to an f32.

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

1 participant