Modern BBC BASICs (both mine and Michael McConnell's Matrix Brandy) support signed 64-bit integer variables, represented by a double % suffix, e.g. a%%. Such variables can hold any whole number from -2^63 (-9223372036854775808) to 2^63-1 (9223372036854775807) inclusive.
So you might think that this code would be entirely valid, but it isn't:
Code: Select all
a%% = 2^63 - 1
To solve this problem you could, for example, perform the assignment as follows:
Code: Select all
a%% = 2^62 - 1 + 2^62
The 'gotcha' comes from the fact that the first example above does actually work when performed on an x86 CPU, but it fails when performed on an ARM CPU. The reason is that the x86 has 80-bit floats and the ARM has only 64-bit floats. So you could include it in a program which you test, say, in Windows only to find it fails when run on a Raspberry Pi.
Just something to be aware of (although I'm almost certain to forget again).