aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-11-25 11:29:32 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-11-25 11:29:32 -0200
commitdb724e14e0b456a980f16a8adec4f20708c11af4 (patch)
treed374a4135a6c762c54219b5bfa71e6e5d8953be0
parent1702953293ebdd770963b6fc0499d87d08f05a82 (diff)
downloadlua-db724e14e0b456a980f16a8adec4f20708c11af4.tar.gz
lua-db724e14e0b456a980f16a8adec4f20708c11af4.tar.bz2
lua-db724e14e0b456a980f16a8adec4f20708c11af4.zip
new macro luai_numisnan
-rw-r--r--lcode.c4
-rw-r--r--ltable.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/lcode.c b/lcode.c
index 3ca3a459..58325b5b 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.21 2005/11/08 19:44:31 roberto Exp roberto $ 2** $Id: lcode.c,v 2.22 2005/11/16 11:55:27 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -647,7 +647,7 @@ static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
647 case OP_LEN: return 0; /* no constant folding for 'len' */ 647 case OP_LEN: return 0; /* no constant folding for 'len' */
648 default: lua_assert(0); r = 0; break; 648 default: lua_assert(0); r = 0; break;
649 } 649 }
650 if (r != r) return 0; /* do not attempt to produce NaN */ 650 if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */
651 e1->u.nval = r; 651 e1->u.nval = r;
652 return 1; 652 return 1;
653} 653}
diff --git a/ltable.c b/ltable.c
index b640a809..9ad52cfe 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.26 2005/07/11 14:01:37 roberto Exp roberto $ 2** $Id: ltable.c,v 2.27 2005/10/24 17:37:52 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -495,7 +495,7 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
495 return cast(TValue *, p); 495 return cast(TValue *, p);
496 else { 496 else {
497 if (ttisnil(key)) luaG_runerror(L, "table index is nil"); 497 if (ttisnil(key)) luaG_runerror(L, "table index is nil");
498 else if (ttisnumber(key) && !luai_numeq(nvalue(key), nvalue(key))) 498 else if (ttisnumber(key) && luai_numisnan(nvalue(key)))
499 luaG_runerror(L, "table index is NaN"); 499 luaG_runerror(L, "table index is NaN");
500 return newkey(L, t, key); 500 return newkey(L, t, key);
501 } 501 }