diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-12-20 16:37:00 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-12-20 16:37:00 -0200 |
| commit | 9903dd52a39fbe4531596b1266e226f01769de21 (patch) | |
| tree | 98bce931ed24b087fffa52123c8f8c23fe39e4f4 /lmathlib.c | |
| parent | 24f6e236a3346183fe8a946568e6b0cd864abd42 (diff) | |
| download | lua-9903dd52a39fbe4531596b1266e226f01769de21.tar.gz lua-9903dd52a39fbe4531596b1266e226f01769de21.tar.bz2 lua-9903dd52a39fbe4531596b1266e226f01769de21.zip | |
Using LUAI_UAC* types more consistently on vararg calls
Diffstat (limited to 'lmathlib.c')
| -rw-r--r-- | lmathlib.c | 11 |
1 files changed, 7 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.116 2015/06/26 19:30:32 roberto Exp $ | 2 | ** $Id: lmathlib.c,v 1.117 2015/10/02 15:39:23 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 | */ |
| @@ -184,10 +184,13 @@ static int math_log (lua_State *L) { | |||
| 184 | else { | 184 | else { |
| 185 | lua_Number base = luaL_checknumber(L, 2); | 185 | lua_Number base = luaL_checknumber(L, 2); |
| 186 | #if !defined(LUA_USE_C89) | 186 | #if !defined(LUA_USE_C89) |
| 187 | if (base == 2.0) res = l_mathop(log2)(x); else | 187 | if (base == l_mathop(2.0)) |
| 188 | res = l_mathop(log2)(x); else | ||
| 188 | #endif | 189 | #endif |
| 189 | if (base == 10.0) res = l_mathop(log10)(x); | 190 | if (base == l_mathop(10.0)) |
| 190 | else res = l_mathop(log)(x)/l_mathop(log)(base); | 191 | res = l_mathop(log10)(x); |
| 192 | else | ||
| 193 | res = l_mathop(log)(x)/l_mathop(log)(base); | ||
| 191 | } | 194 | } |
| 192 | lua_pushnumber(L, res); | 195 | lua_pushnumber(L, res); |
| 193 | return 1; | 196 | return 1; |
