Skip to content

Commit 5903ff6

Browse files
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.
1 parent f805364 commit 5903ff6

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)