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

mochinum:digits/1: fix handling of -0.0 for OTP-26.1/27.0 #260

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

mikpe
Copy link
Contributor

@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 mochiweb results in:

src/mochinum.erl:47:8: Warning: 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 a match to a numerical comparison.

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 mochiweb results in:

src/mochinum.erl:47:8: Warning: 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 a match to a numerical comparison.
Copy link
Collaborator

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Thank you, @mikpe

@nickva nickva merged commit 97573d2 into mochi:main Sep 22, 2023
8 checks passed
@etrepum
Copy link
Member

etrepum commented Sep 22, 2023

Thanks @mikpe! I've tagged v3.2.1 with this fix

@mikpe mikpe deleted the fix-match-on-float-zero branch September 23, 2023 15:02
beerriot added a commit to beerriot/webmachine that referenced this pull request Oct 21, 2023
mochi/mochiweb#260 is the same sort of fix as webmachine#340 -
updating floating point 0.0 matching for OTP 27 compatibility
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.

3 participants