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 order between FloatingPoints and Rationals #12041

Closed
blkqi opened this issue Jul 6, 2015 · 5 comments
Closed

Inconsistent order between FloatingPoints and Rationals #12041

blkqi opened this issue Jul 6, 2015 · 5 comments

Comments

@blkqi
Copy link

blkqi commented Jul 6, 2015

See the "Note" section of the online documentation for round():
http://julia.readthedocs.org/en/latest/stdlib/math/#Base.round

When trying this on julia v0.3.10 I discovered the following inconsistency which seems to break the trichotomy law.

julia> x = 1.15
1.15

julia> @sprintf "%.20f" x
"1.14999999999999991118"

julia> x < 115//100
false

julia> x > 115//100
false

julia> x == 115//100
false
@tkelman
Copy link
Contributor

tkelman commented Jul 6, 2015

Can you try this on an 0.4-dev nightly? I think @simonbyrne fixed this a few months ago on master.

@blkqi
Copy link
Author

blkqi commented Jul 6, 2015

No problem. This is not an issue using the latest nightly: julia-6eb9133679.

@blkqi blkqi closed this as completed Jul 6, 2015
@yuyichao
Copy link
Contributor

yuyichao commented Jul 6, 2015

Should the fix be backported?

@tkelman
Copy link
Contributor

tkelman commented Jul 6, 2015

Would have to dig up which PR it was ("fix comparisons between floating point and rationals" or something like that), but at this point I'd rather not make substantial behavioral changes on release-0.3.

edit: #9198 uses staged functions apparently

@yuyichao
Copy link
Contributor

yuyichao commented Jul 6, 2015

Wasn't too hard given the author and the keywords. #9198.

Indeed looks a little too big (changes and lines) to be backported for me....

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

3 participants