aboutsummaryrefslogtreecommitdiff
path: root/luaconf.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-05-27 10:59:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-05-27 10:59:03 -0300
commit84db17b6fc366b26eca33d4d5f6b3a204518e9dd (patch)
tree969cb959827f839b85e15b8ac258672c08ee5590 /luaconf.h
parent456806f25c239bf36039fc2742547547cc55fbb1 (diff)
downloadlua-84db17b6fc366b26eca33d4d5f6b3a204518e9dd.tar.gz
lua-84db17b6fc366b26eca33d4d5f6b3a204518e9dd.tar.bz2
lua-84db17b6fc366b26eca33d4d5f6b3a204518e9dd.zip
more "religious" definition for 'lua_numtointeger'
Diffstat (limited to 'luaconf.h')
-rw-r--r--luaconf.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/luaconf.h b/luaconf.h
index bb2b776b..d470b71d 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.203 2014/05/21 15:24:21 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.204 2014/05/26 17:10:22 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -508,19 +508,17 @@
508/* 508/*
509@@ lua_numtointeger converts a float number to an integer, or 509@@ lua_numtointeger converts a float number to an integer, or
510** return 0 if float is not within the range of a lua_Integer. 510** return 0 if float is not within the range of a lua_Integer.
511** (The comparisons are tricky because of rounding, which can or 511** (The comparisons are tricky because of rounding.
512** not occur depending on the relative sizes of floats and integers.
513** The tests here assume a two-complement representation, where 512** The tests here assume a two-complement representation, where
514** MININTEGER always has an exact representation as a float, 513** MININTEGER always has an exact representation as a float,
515** while if LUA_MAXINTEGER has an exact representation, so does 514** while LUA_MAXINTEGER may not have one, and therefore its
516** (LUA_MAXINTEGER + 1); otherwise, LUA_MAXINTEGER is equal to 515** conversion to float may have an ill-defined value.)
517** (LUA_MAXINTEGER + 1) when converted to a float.)
518** This macro should be used only when 'n' has an integral value. 516** This macro should be used only when 'n' has an integral value.
519*/ 517*/
520#define lua_numtointeger(n,p) \ 518#define lua_numtointeger(n,p) \
521 (((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ 519 ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
522 (n) < (LUA_NUMBER)(LUA_MAXINTEGER) + 1) && \ 520 (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
523 (*p = (LUA_INTEGER)(n), 1)) 521 (*p = (LUA_INTEGER)(n), 1))
524 522
525 523
526/* 524/*