diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-06-13 18:20:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-06-13 18:20:14 -0300 |
commit | 1f9f97e3cfcb80bdf06ec5fc051fa6ccf98db45b (patch) | |
tree | af918757e82ef29c3cce8062a513322ef0ed8dcb /lmathlib.c | |
parent | 34aac33c15b8622004b34d08bec28cae2141675a (diff) | |
download | lua-1f9f97e3cfcb80bdf06ec5fc051fa6ccf98db45b.tar.gz lua-1f9f97e3cfcb80bdf06ec5fc051fa6ccf98db45b.tar.bz2 lua-1f9f97e3cfcb80bdf06ec5fc051fa6ccf98db45b.zip |
'math.mod' -> 'math.fmod'
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.62 2005/01/07 20:00:33 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.63 2005/03/04 18:57:03 roberto Exp roberto $ |
3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -88,7 +88,7 @@ static int math_floor (lua_State *L) { | |||
88 | return 1; | 88 | return 1; |
89 | } | 89 | } |
90 | 90 | ||
91 | static int math_mod (lua_State *L) { | 91 | static int math_fmod (lua_State *L) { |
92 | lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); | 92 | lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); |
93 | return 1; | 93 | return 1; |
94 | } | 94 | } |
@@ -226,7 +226,7 @@ static const luaL_reg mathlib[] = { | |||
226 | {"atan2", math_atan2}, | 226 | {"atan2", math_atan2}, |
227 | {"ceil", math_ceil}, | 227 | {"ceil", math_ceil}, |
228 | {"floor", math_floor}, | 228 | {"floor", math_floor}, |
229 | {"mod", math_mod}, | 229 | {"fmod", math_fmod}, |
230 | {"modf", math_modf}, | 230 | {"modf", math_modf}, |
231 | {"frexp", math_frexp}, | 231 | {"frexp", math_frexp}, |
232 | {"ldexp", math_ldexp}, | 232 | {"ldexp", math_ldexp}, |
@@ -254,6 +254,10 @@ LUALIB_API int luaopen_math (lua_State *L) { | |||
254 | lua_setfield(L, -2, "pi"); | 254 | lua_setfield(L, -2, "pi"); |
255 | lua_pushnumber(L, HUGE_VAL); | 255 | lua_pushnumber(L, HUGE_VAL); |
256 | lua_setfield(L, -2, "huge"); | 256 | lua_setfield(L, -2, "huge"); |
257 | #if defined(LUA_COMPAT_MOD) | ||
258 | lua_getfield(L, -1, "fmod"); | ||
259 | lua_setfield(L, -2, "mod"); | ||
260 | #endif | ||
257 | return 1; | 261 | return 1; |
258 | } | 262 | } |
259 | 263 | ||