Shatterhand
2014-07-09 16:34:08
I was making some reflection functions in java and used the SRL API as a base. Then I ran into this problem. :)
Ill show the code and outputs in java and pascal.
Not the same? Lets see why…
As you can see, in pascal, when it would overflow, it changes the order. Took some hours to find this. So confusing… :D
Ill show the code and outputs in java and pascal.
System.out.println(-648456136 * -1715187017 / 2048.0 * 360);
OUTPUT 1.40625
Writeln(-648456136 * -1715187017 / 2048.0 * 360);
OUTPUT 1.95508045118177E17Not the same? Lets see why…
System.out.println(-648456136 * -1715187017);
OUTPUT 8
Writeln(-648456136 * -1715187017);
OUTPUT 8System.out.println(-648456136 * -1715187017 / 2048.0);
OUTPUT 0.00390625 = 8 / 2048
Writeln(-648456136 * -1715187017 / 2048.0);
OUTPUT 543077903106048 = -648456136 * (-1715187017 / 2048.0)As you can see, in pascal, when it would overflow, it changes the order. Took some hours to find this. So confusing… :D