summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-26 11:56:25 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-26 11:56:25 +0200
commit90b08919d1ab82020984b0810316f62899b5912a (patch)
tree4077c5cb50b9ae068f9892629c97f991ffdafe66 /src
parent7d3c71ca17ccc8f93f1e9d1cad75a3b9ec6bca12 (diff)
downloadfengari-90b08919d1ab82020984b0810316f62899b5912a.tar.gz
fengari-90b08919d1ab82020984b0810316f62899b5912a.tar.bz2
fengari-90b08919d1ab82020984b0810316f62899b5912a.zip
Added missing test in luaL_tolstring
Diffstat (limited to 'src')
-rw-r--r--src/lauxlib.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index a70e5d0..d84f174 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -375,10 +375,11 @@ const luaL_tolstring = function(L, idx) {
s = '-inf';
else if (Number.isNaN(n))
s = 'nan';
- else if (a >= 100000000000000 || a < 0.0001)
+ else if (a >= 100000000000000 || (a > 0 && a < 0.0001))
s = n.toExponential();
else
s = n.toPrecision(16).replace(/(\.[0-9][1-9]*)0+$/, "$1");
+
lua.lua_pushstring(L, lua.to_luastring(s));
}
break;