I was asking myself what are the differences between integer and float firmware and how deal with them. All I've been able to find so far is:
the integer version which supports only integer operations and the float version which contains support for floating point calculations
Ok, so far so good, but wat does this mean in real life?
What happens, when I calculate
a = 3/2
For the float version I'd expect a = 1.5
For the integer version I'd expect a = 1. Or will a equal 2 or does it throw an error or crash or something else? I know, I've could simply flash the integer version and give it a try, but I'd also like to discuss it have it answered here. :)
What other limitations/differences exist? The main reason I am asking: I tried to run some scripts on integer version without any float operations I am aware of and some functionality simply isn't there. With the float version it works as expected.
Update:
Here ist the snippet that produces an unexpected result:
local duration = (now - eventStart)
duration is 0 with integer firmware. I'd guess it is because now an eventStart are too large for integer:
now: 1477651622514913
eventStart: 1477651619238587
So I'd say other limitations are that the integer version only supports integer operations with 31 bit values because when I convert
now = tonumber(now)
now = 2147483647 which is 2^31 - 1
so in integer firmware
1477651622514913 - 1477651619238587 = 0
is the same as
2147483647 - 2147483647
which is obviously 0