Re: literal 9223372036854775808 is negative
- Posted by petelomax in May
- 552 views
Windows Calculator does the same thing.
Select Programmer mode and enter 1 << 63 you get -9223372036854775808.
LOL. I must be biased because Phix gets it right....
Of course the calculator is using an int64 rather than a uint64 (in programmer mode, that is, IEEE-754s everywhere else).
In Eu terms (and with some quite hefty poetic licence) it is a bit like #3F + 1 being stored not as the positive #40 but
as the negative #C0 (yeah, I know they don't quite line up). I can only assume the parser is getting a switchover wrong:
I seem to recall but could be imagining this, when it finds a decimal point or when things get too big it simply discards
the int it's been building and starts again in a float. Maybe it is only #8000.., and fine +/-1 or more away from that.
Speaking of which, we found (some time ago) specifying the exact same value as #8000000000000000 works fine, as does
specifying it as 9223372036854775808.0 (!) or power(2,63). Hence it is the Euphoria bug I think it is.
I am going to push a bit harder on this now, because we've just spent a frustrating four weeks trying to figure out the
best way to deal with(/gloss over) this[DONE], when of course the proper thing would be to get it fixed.
Plus I think I fully understand the issue now, just not where the bit of code going wrong is, point me at it if you need help.