aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-08-01 11:55:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-08-01 11:55:33 -0300
commitcc02b4729bf56a1b95a96841bad7b3570d98d3d6 (patch)
tree2d50a8291b1a0f14d3c2450576b750a088ee8834
parent2bb3830fc1ddbab00bf7b7785a27794fbe7be5f9 (diff)
downloadlua-cc02b4729bf56a1b95a96841bad7b3570d98d3d6.tar.gz
lua-cc02b4729bf56a1b95a96841bad7b3570d98d3d6.tar.bz2
lua-cc02b4729bf56a1b95a96841bad7b3570d98d3d6.zip
new mod implementation (more portable).
-rw-r--r--mathlib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mathlib.c b/mathlib.c
index f01e149d..896ec1f5 100644
--- a/mathlib.c
+++ b/mathlib.c
@@ -3,7 +3,7 @@
3** Mathematics library to LUA 3** Mathematics library to LUA
4*/ 4*/
5 5
6char *rcs_mathlib="$Id: mathlib.c,v 1.16 1996/04/25 14:10:00 roberto Exp roberto $"; 6char *rcs_mathlib="$Id: mathlib.c,v 1.17 1996/04/30 21:13:55 roberto Exp roberto $";
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9#include <math.h> 9#include <math.h>
@@ -92,9 +92,9 @@ static void math_floor (void)
92 92
93static void math_mod (void) 93static void math_mod (void)
94{ 94{
95 int d1 = (int)lua_check_number(1, "mod"); 95 float x = lua_check_number(1, "mod");
96 int d2 = (int)lua_check_number(2, "mod"); 96 float y = lua_check_number(2, "mod");
97 lua_pushnumber (d1%d2); 97 lua_pushnumber(fmod(x, y));
98} 98}
99 99
100 100