Calculation result comparison differs under C backend
Posted: Sat Nov 25, 2023 9:44 am
I switched to the C backend for the first time and noticed a variation when I'm comparing the result of a calculation against an expected total. It fails the comparison with the correct result when the product of the multiplication exceeds the limit of longs, although I'm comparing that result with a quad. It appears to be resolved easily by putting Int() around either, or both, of the longs, but I'm not sure why it needs that. This doesn't happen under ASM but should I be able to do this?
Any of the following approaches solves the conditional test :
Code: Select all
OpenConsole()
Define blocks.l = 163840
Define blocksize.l = 16384
Define filesize.q = 2684354560
If blocks.l * blocksize.l <> filesize.q
PrintN("Conditional test fails :")
PrintN(" blocks.l = " + Str(blocks.l))
PrintN(" blocksize.l = " + Str(blocksize.l))
PrintN(" filesize.q = " + Str(filesize.q))
PrintN("")
PrintN(" Conditional test of " + Str(blocks.l * blocksize.l) + " does not match " + Str(filesize.q))
EndIf
Input()
Code: Select all
If int(blocks.l) * blocksize.l <> filesize.q
If blocks.l * int(blocksize.l) <> filesize.q
If int(blocks.l * blocksize.l) <> filesize.q