[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Use of math.huge on 64bit Linux
- From: Sean Conner <sean@...>
- Date: Wed, 5 Mar 2014 15:16:05 -0500
Okay, I'm using Lua 5.1.5 (and all the patches ) and for the life of
me, I can't figure out what I'm doing wrong. I have this script:
proc = require "org.conman.process" -- 
proc.limits.soft.core = math.huge
On 32-bit Linux, the output is as expected:
But on two different 64-bit Linux systems, I get:
I'm not seeing any obvious issues with the function . I traced into
the function, and after it executes:
ival = lua_tonumber(L,3);
ival is 0, when it should be HUGE_VAL (which on Linux, prints out as 'inf').
Tracing into lua_tonumber() doesn't reveal anything, so next, write a
simplified test program to hopefully isolate the issue:
static int huge(lua_State *L)
ival = lua_tonumber(L,1);
int luaopen_huge(lua_State *L)
And the following script:
huge = require "huge"
Running this on both 64-bit systems, the output is:
which is *NOT* what I expected (and is, in fact, correct). So obviously, I
haven't isolated the issue, but I'm not just seeing what could be going
wrong. I don't think it's because of the fact that I compiled everything
into a custom Lua interpreter with all the modules built in, because I built
in the above module and it still worked.
I'm missing something obvious and I'm not seeing it.