And honestly, I don't understand this... I can see why floating point math is affected the way it is, but INTEGER math? This one was a total shock to me, when STx first showcased code which highlighted the issue. Now, there might be some simple trick like making that a 2~&& ^ 55~&&, or such, but at the end of the day, just changing from normal precision to double precision can make a large difference, as shown above.
This should be fixed in the latest development build.
What's going on here? There's multiple factors at play. First that that pow() is inherently a 'floaty" function. It always returns a floating point number. In QB64 we use the version that returns a long double (113 bits of precision), which should be enough to hold even a 64 bit integer perfectly. Because pow() is floaty, it means the subtraction is actually a floating-point operation. The resulting floating-point number is then rounded to fit into a 64 bit integer variable.
The x87 FPU can be in several rounding modes. The two of interest are double mode (53 bits of precision) and extended mode (64 bits of precision). This effectively controls how many bits of precision are available in the result of any floating point operation. If the FPU were in double mode, 2 ^ 55 is beyond the range (note it needs 55 bits, we only have 53) in which you can represent each integer (with floating point the available numbers become less dense as you get bigger), so subtracting 1 has no effect on the value. In extended mode all is well because we have the extra bits.
QB64 used what appeared to be a Windows-specific function _controlfp to set the FPU mode. From a brief read of the documentation it appears the extended mode is not supported on x86_64, which doesn't make much sense but is consistent with this working in 32-bit QB64 but not 64-bit QB64. I have changed it to use the fldcw instruction directly.
Side note: Linux by default sets extended mode, which is why this error wasn't visible there. Apparently BSD uses double mode by default, so I guess this is a win for BSD users too?