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

Use bit-pattern comparison when meeting float approximations (flambda) #1810

Merged
merged 3 commits into from Jun 1, 2018

Conversation

Projects
None yet
3 participants
@xclerc
Copy link
Contributor

xclerc commented Jun 1, 2018

Fixes the bug reported by @Chris00 in #1794.

The bug is that flambda used Stdlib.(=) to compare float values
(thus considering -0. and +0. equal) while applying a transform
that simplifies if ... then e1 else e2 when e1 and e2 have the
same approximation.

(If time permits, I think it should be considered for inclusion in 4.07.)

@xclerc xclerc changed the title Use bit-pattern comparison when meeting float approximations Use bit-pattern comparison when meeting float approximations (flambda) Jun 1, 2018

@nojb

nojb approved these changes Jun 1, 2018

Copy link
Contributor

nojb left a comment

Patch seems clearly correct. LGTM.

@@ -655,6 +655,12 @@ let equal_boxed_int (type t1) (type t2)
| Nativeint, Nativeint -> Nativeint.equal i1 i2
| _ -> false

let compare_floats f1 f2 =

This comment has been minimized.

@gasche

gasche Jun 1, 2018

Member

This should be named equal_floats.

This comment has been minimized.

@xclerc

xclerc Jun 1, 2018

Author Contributor

Indeed, thanks.

@nojb

This comment has been minimized.

Copy link
Contributor

nojb commented Jun 1, 2018

Personally I think this is safe for inclusion in 4.07. @damiendoligez?

@gasche gasche merged commit 2707e3e into ocaml:trunk Jun 1, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

gasche added a commit that referenced this pull request Jun 1, 2018

Merge pull request #1810 from xclerc/fix-approx-meet-float
Use bit-pattern comparison when meeting float approximations (flambda)

(cherry picked from commit 2707e3e)
@gasche

This comment has been minimized.

Copy link
Member

gasche commented Jun 1, 2018

Merged and cherry-picked in 4.07.

@xclerc xclerc deleted the xclerc:fix-approx-meet-float branch Jun 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.