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

jesse: fix handling of -0.0 for OTP-26.1/27.0 #129

Closed
wants to merge 1 commit into from

Conversation

mikpe
Copy link

@mikpe mikpe commented Sep 22, 2023

Matching of floating-point zeroes will change in OTP-27 so that -0.0 will no longer match a non-negative 0.0. OTP-26.1 warns about such constructs, which in jesse results in:

===> Compiling src/jesse_validator_draft3.erl failed src/jesse_validator_draft3.erl:865:5: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

===> Compiling src/jesse_validator_draft4.erl failed src/jesse_validator_draft4.erl:1019:5: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

===> Compiling src/jesse_validator_draft6.erl failed src/jesse_validator_draft6.erl:997:5: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

Fixed by switching from matches to numerical comparisons.

Matching of floating-point zeroes will change in OTP-27 so that -0.0 will
no longer match a non-negative 0.0. OTP-26.1 warns about such constructs,
which in jesse results in:

===> Compiling src/jesse_validator_draft3.erl failed
src/jesse_validator_draft3.erl:865:5: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

===> Compiling src/jesse_validator_draft4.erl failed
src/jesse_validator_draft4.erl:1019:5: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

===> Compiling src/jesse_validator_draft6.erl failed
src/jesse_validator_draft6.erl:997:5: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

Fixed by switching from matches to numerical comparisons.
@srijan
Copy link

srijan commented Sep 24, 2023

Dupe of #128 ?

@mikpe
Copy link
Author

mikpe commented Sep 24, 2023

Dupe of #128 ?

Yes

@seriyps
Copy link
Collaborator

seriyps commented Sep 29, 2023

I merged #128, so closing this one.

@seriyps seriyps closed this Sep 29, 2023
@mikpe mikpe deleted the fix-matches-on-float-zero branch September 29, 2023 14:18
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 this pull request may close these issues.

None yet

3 participants