diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-30 16:48:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-30 16:48:08 -0300 |
commit | b9dcf9974d4dbff3ca28ff618259e277cb0090ea (patch) | |
tree | 66b903add6a56545bb50fda02d33baab24ba44d5 /lmathlib.c | |
parent | a77d263e86feea55529800028f960d7124c1385f (diff) | |
download | lua-b9dcf9974d4dbff3ca28ff618259e277cb0090ea.tar.gz lua-b9dcf9974d4dbff3ca28ff618259e277cb0090ea.tar.bz2 lua-b9dcf9974d4dbff3ca28ff618259e277cb0090ea.zip |
detail (typos in comments)
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.103 2014/06/18 12:35:53 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.104 2014/06/26 18:38:28 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 | */ |
@@ -145,14 +145,14 @@ static int math_fmod (lua_State *L) { | |||
145 | static int math_modf (lua_State *L) { | 145 | static int math_modf (lua_State *L) { |
146 | if (lua_isinteger(L ,1)) { | 146 | if (lua_isinteger(L ,1)) { |
147 | lua_settop(L, 1); /* number is its own integer part */ | 147 | lua_settop(L, 1); /* number is its own integer part */ |
148 | lua_pushnumber(L, 0); /* no fractionary part */ | 148 | lua_pushnumber(L, 0); /* no fractional part */ |
149 | } | 149 | } |
150 | else { | 150 | else { |
151 | lua_Number n = luaL_checknumber(L, 1); | 151 | lua_Number n = luaL_checknumber(L, 1); |
152 | /* integer part (rounds toward zero) */ | 152 | /* integer part (rounds toward zero) */ |
153 | lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); | 153 | lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); |
154 | pushnumint(L, ip); | 154 | pushnumint(L, ip); |
155 | /* fractionary part (test needed for inf/-inf) */ | 155 | /* fractional part (test needed for inf/-inf) */ |
156 | lua_pushnumber(L, (n == ip) ? 0.0 : (n - ip)); | 156 | lua_pushnumber(L, (n == ip) ? 0.0 : (n - ip)); |
157 | } | 157 | } |
158 | return 2; | 158 | return 2; |