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

Inconsistent rounding when converting from f32 #24

Closed
keram88 opened this issue May 11, 2019 · 0 comments · Fixed by #25
Closed

Inconsistent rounding when converting from f32 #24

keram88 opened this issue May 11, 2019 · 0 comments · Fixed by #25

Comments

@keram88
Copy link

keram88 commented May 11, 2019

Hello,

I found that some f32 values are converted differently depending on whether use-intrinsics is enabled or not. I am using the 1.3.0 release version.

For example:

use half::f16;

let f = 2.9802322e-8f32;
let f2 = f16::from_f32(f);
println!("{}", f2);

prints 0 when intrinsics are enabled and 0.000000059604645 when intrinsics are not enabled.

I also found an example that is potentially a rounding direction mismatch:

use half::f16;

let f = 520.25f32;
let f2 = f16::from_f32(f);
println!("{}", f2);

prints 520 when intrinsics are enabled and 520.5 when not enabled.

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

Successfully merging a pull request may close this issue.

1 participant