I've used BCPL for many 64 bit Project Euler problems, but I've noticed an issue when compile-time expressions exceed 32 bits; the results are incorrect. Here is an example:
GET "libhdr"
LET start() = VALOF {
LET x = ?
x := 999 * 10_000_000
writef("x = %d *n", x)
x := 999
x *:= 10_000_000
writef("x = %d *n", x)
RESULTIS 0
}
Using bcpl64 compile, the output is:
x = 14284967296
x = 9990000000
The first result, where the compiler did constant folding is wrong. The second result, where the the calculation was done at runtime is correct.
I've used BCPL for many 64 bit Project Euler problems, but I've noticed an issue when compile-time expressions exceed 32 bits; the results are incorrect. Here is an example:
GET "libhdr" LET start() = VALOF { LET x = ? x := 999 * 10_000_000 writef("x = %d *n", x) x := 999 x *:= 10_000_000 writef("x = %d *n", x) RESULTIS 0 }Using bcpl64 compile, the output is:
x = 14284967296
x = 9990000000
The first result, where the compiler did constant folding is wrong. The second result, where the the calculation was done at runtime is correct.