Steevee28 wrote: > Things seem to be very complicated regarding Lua's internal value > representation of the -number- type, see LUA_NUMBER_TYPE definition in > 'luaconf.h' > (https://github.com/ralph-irving/squeezeos-squeezeplay/blob/cd98c71c4394cc39f6715014aedf8bc1c8550b96/src/lua-5.1.1/src/luaconf.h#L16). > > I just stumbled across 'this discussion' > (https://forums.slimdevices.com/showthread.php?111663-Community-Build-Radio-Firmware&p=995599&viewfull=1#post995599) > between @mrw and @ralphy which I completely missed so far and I was not > aware that they already struggled this much to find a solution for the > wrapping problem. Wow!
Ah yes. There was talking about introducing an integer type to LUA for some time, but it produced weird results. I got confronted with that when another application I used to use (Domoticz) suddenly changed its code base to use this integer type and all my automation scripts started failing after I installed the update. Either way, since the source of this issue lies in an apparent requirement for the C code and the LUA scripts to use the exact same value for some number at any given time the obvious solution is to make both environments use a compatible number format. As stated it will be dubious to store an integer value in a double, but then again it isn't actually an integer as it represents the sum of seconds and milliseconds which are itself of type time_t which is likely a floating point value as well (at least on 32 bit systems). The main problem with using a double is that you can not reliably keep adding 1 all the way to MAX_VAL, but if memory serves correct it will be accurate up to ~50 bit integer values on 32 bit systems and would therefore allow integer precision for jive_jiffies() for several years. Note that this is not related to the pull request I made. That one is purely for keeping the conversion method from C unsigned integer to lua_Number to alter the number sign when pushing it onto the LUA stack. ------------------------------------------------------------------------ gordonb3's Profile: http://forums.slimdevices.com/member.php?userid=71050 View this thread: http://forums.slimdevices.com/showthread.php?t=111650 _______________________________________________ Radio mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/radio
