more "religious" definition for 'lua_numtointeger'
This commit is contained in:
16
luaconf.h
16
luaconf.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: luaconf.h,v 1.203 2014/05/21 15:24:21 roberto Exp roberto $
|
** $Id: luaconf.h,v 1.204 2014/05/26 17:10:22 roberto Exp roberto $
|
||||||
** Configuration file for Lua
|
** Configuration file for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -508,19 +508,17 @@
|
|||||||
/*
|
/*
|
||||||
@@ lua_numtointeger converts a float number to an integer, or
|
@@ lua_numtointeger converts a float number to an integer, or
|
||||||
** return 0 if float is not within the range of a lua_Integer.
|
** return 0 if float is not within the range of a lua_Integer.
|
||||||
** (The comparisons are tricky because of rounding, which can or
|
** (The comparisons are tricky because of rounding.
|
||||||
** not occur depending on the relative sizes of floats and integers.
|
|
||||||
** The tests here assume a two-complement representation, where
|
** The tests here assume a two-complement representation, where
|
||||||
** MININTEGER always has an exact representation as a float,
|
** MININTEGER always has an exact representation as a float,
|
||||||
** while if LUA_MAXINTEGER has an exact representation, so does
|
** while LUA_MAXINTEGER may not have one, and therefore its
|
||||||
** (LUA_MAXINTEGER + 1); otherwise, LUA_MAXINTEGER is equal to
|
** conversion to float may have an ill-defined value.)
|
||||||
** (LUA_MAXINTEGER + 1) when converted to a float.)
|
|
||||||
** This macro should be used only when 'n' has an integral value.
|
** This macro should be used only when 'n' has an integral value.
|
||||||
*/
|
*/
|
||||||
#define lua_numtointeger(n,p) \
|
#define lua_numtointeger(n,p) \
|
||||||
(((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
|
((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
|
||||||
(n) < (LUA_NUMBER)(LUA_MAXINTEGER) + 1) && \
|
(n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
|
||||||
(*p = (LUA_INTEGER)(n), 1))
|
(*p = (LUA_INTEGER)(n), 1))
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user