diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-08-01 11:55:33 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-08-01 11:55:33 -0300 |
| commit | cc02b4729bf56a1b95a96841bad7b3570d98d3d6 (patch) | |
| tree | 2d50a8291b1a0f14d3c2450576b750a088ee8834 /mathlib.c | |
| parent | 2bb3830fc1ddbab00bf7b7785a27794fbe7be5f9 (diff) | |
| download | lua-github-cc02b4729bf56a1b95a96841bad7b3570d98d3d6.tar.gz | |
new mod implementation (more portable).
Diffstat (limited to 'mathlib.c')
| -rw-r--r-- | mathlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -3,7 +3,7 @@ ** Mathematics library to LUA */ -char *rcs_mathlib="$Id: mathlib.c,v 1.16 1996/04/25 14:10:00 roberto Exp roberto $"; +char *rcs_mathlib="$Id: mathlib.c,v 1.17 1996/04/30 21:13:55 roberto Exp roberto $"; #include <stdlib.h> #include <math.h> @@ -92,9 +92,9 @@ static void math_floor (void) static void math_mod (void) { - int d1 = (int)lua_check_number(1, "mod"); - int d2 = (int)lua_check_number(2, "mod"); - lua_pushnumber (d1%d2); + float x = lua_check_number(1, "mod"); + float y = lua_check_number(2, "mod"); + lua_pushnumber(fmod(x, y)); } |
