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

float16 trunc doesn't work for certain input #15993

Closed
yuyichao opened this issue Apr 21, 2016 · 2 comments
Closed

float16 trunc doesn't work for certain input #15993

yuyichao opened this issue Apr 21, 2016 · 2 comments
Labels
test This change adds or pertains to unit tests

Comments

@yuyichao
Copy link
Contributor

Happened on AppVeyor win64 for #15984 (https://ci.appveyor.com/project/JuliaLang/julia/build/1.0.726/job/qux4bbryj4uuf9ts)

Basically the test doesn't work for any input with fractional larger than 0.99975586.

julia> x = 0.99975586f0
0.99975586f0

julia> trunc(Int,Float16(x)) == trunc(Int,x)
false

julia> Float16(x)
Float16(1.0)

julia> trunc(Int,x)
0

I'm not sure if the impl is wrong or the test is wrong. @kshyatt

@yuyichao yuyichao added the test This change adds or pertains to unit tests label Apr 21, 2016
@yuyichao
Copy link
Contributor Author

Assuming the Float16 constructor use the default RoundNearest in this case I guess the test is wrong here...

yuyichao added a commit that referenced this issue Apr 21, 2016
Do not use `rand()` and test both round up and down in different functions.

Closes #15993
@tkelman
Copy link
Contributor

tkelman commented Apr 22, 2016

Yeah, the test is wrong. I think this has come up before.

tkelman pushed a commit that referenced this issue Jun 17, 2016
Do not use `rand()` and test both round up and down in different functions.

Closes #15993

(cherry picked from commit 6612826)
ref #15994
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test This change adds or pertains to unit tests
Projects
None yet
Development

No branches or pull requests

2 participants