diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-08-28 12:36:58 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-08-28 12:36:58 -0300 |
commit | 5382a22e0eea878339c504b2a9a3b36bcd839fcc (patch) | |
tree | f4208ffe221d2f42920c751c3624f17d89b07079 /lvm.h | |
parent | 8c8a91f2ef7acccb99e3737913faad8d48b39571 (diff) | |
download | lua-5382a22e0eea878339c504b2a9a3b36bcd839fcc.tar.gz lua-5382a22e0eea878339c504b2a9a3b36bcd839fcc.tar.bz2 lua-5382a22e0eea878339c504b2a9a3b36bcd839fcc.zip |
Corrections in the implementation of '%' for floats.
The multiplication (m*b) used to test whether 'm' is non-zero and
'm' and 'b' have different signs can underflow for very small numbers,
giving a wrong result. The use of explicit comparisons solves this
problem. This commit also adds several new tests for '%' (both for
floats and for integers) to exercise more corner cases, such as
very large and very small values.
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -116,6 +116,7 @@ LUAI_FUNC void luaV_execute (lua_State *L, CallInfo *ci); | |||
116 | LUAI_FUNC void luaV_concat (lua_State *L, int total); | 116 | LUAI_FUNC void luaV_concat (lua_State *L, int total); |
117 | LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); | 117 | LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); |
118 | LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); | 118 | LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); |
119 | LUAI_FUNC lua_Number luaV_modf (lua_State *L, lua_Number x, lua_Number y); | ||
119 | LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); | 120 | LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); |
120 | LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); | 121 | LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); |
121 | 122 | ||