Skip to content

Commit 9d98d83

Browse files
michaelklishinmergify[bot]
authored andcommitted
Erlang 27 compat: special case 0.0 (positive and negative) w/o using matching
Erlang 27 erlc requires us to match on both but earlier versions complain that one head of the function is unreachable because the other one always matches. So we avoid pattern matching entirely. (cherry picked from commit 5903ff6) (cherry picked from commit 24c9da9)
1 parent 4dd7323 commit 9d98d83

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

deps/rabbit_common/src/rabbit_numerical.erl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
%% human-readable output, or compact ASCII serializations for floats.
3131
digits(N) when is_integer(N) ->
3232
integer_to_list(N);
33-
digits(+0.0) ->
34-
"0.0";
35-
digits(-0.0) ->
33+
digits(N) when N =:= 0.0 ->
3634
"0.0";
3735
digits(Float) ->
3836
{Frac1, Exp1} = frexp_int(Float),

0 commit comments

Comments
 (0)