mochi / mochiweb

MochiWeb is an Erlang library for building lightweight HTTP servers.
Other
1.86k stars 474 forks source link

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

Closed mikpe closed 11 months ago

mikpe commented 11 months ago

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.

etrepum commented 11 months ago

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