Skip to content

Commit

Permalink
Fix #46: Incorrect results of math.floor and math.ceil
Browse files Browse the repository at this point in the history
  • Loading branch information
Zert committed Jul 30, 2014
1 parent 9d1004b commit 46e9269
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/luerl_lib_math.erl
Expand Up @@ -92,6 +92,7 @@ atan2(As, St) ->

ceil(As, St) ->
case luerl_lib:tonumbers(As) of
[N|_] when round(N) == N -> {[N],St};
[N|_] -> {[float(round(N + 0.5))],St};
_ -> badarg_error(ceil, As, St)
end.
Expand Down Expand Up @@ -122,6 +123,7 @@ exp(As, St) ->

floor(As, St) ->
case luerl_lib:tonumbers(As) of
[N|_] when round(N) == N -> {[N],St};
[N|_] -> {[float(round(N - 0.5))],St};
_ -> badarg_error(floor, As, St)
end.
Expand Down

0 comments on commit 46e9269

Please sign in to comment.