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
You gave the answer to your question yourself. The integer version does not support floating point operations nor does it allow non-integer numbers.
In the integer version 3/2
is 1 rather than 1.5.
I've could simply flash the integer version and give it a try, but I'd also like to discuss it. :)
Stack Overflow is a Q&A site and is thus not well suited for discussions. Use the NodeMCU forums on esp8266.com for that.