aboutsummaryrefslogtreecommitdiff
path: root/lvm.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-08-28 12:36:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-08-28 12:36:58 -0300
commit5382a22e0eea878339c504b2a9a3b36bcd839fcc (patch)
treef4208ffe221d2f42920c751c3624f17d89b07079 /lvm.h
parent8c8a91f2ef7acccb99e3737913faad8d48b39571 (diff)
downloadlua-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.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lvm.h b/lvm.h
index d58daacd..8ead0c50 100644
--- a/lvm.h
+++ b/lvm.h
@@ -116,6 +116,7 @@ LUAI_FUNC void luaV_execute (lua_State *L, CallInfo *ci);
116LUAI_FUNC void luaV_concat (lua_State *L, int total); 116LUAI_FUNC void luaV_concat (lua_State *L, int total);
117LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); 117LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y);
118LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); 118LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y);
119LUAI_FUNC lua_Number luaV_modf (lua_State *L, lua_Number x, lua_Number y);
119LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); 120LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y);
120LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); 121LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb);
121 122