I assume the code is clearly not using Extended . Since this data type differs from 32 to 64 bits (these are 10 bytes in 32 bits and 8 bytes in 64 bits), any explicit use of Extended makes an immediate difference. I assume that you are using Double for all of your variables. Although the arguments below are passed equally to Single .
In addition, the most common reason for this is the difference in behavior between two floating point units.
The x87 block used by 32-bit code stores intermediate values ββup to 80-bit extended precision. The SSE unit used by 64-bit code stores intermediate values ββup to 64-bit double precision.
Now the x87 block can be configured using the control word to store intermediate values ββup to 64-bit precision. It does not matter in terms of performance, but it will be closer to your 32 and 64-bit results.
Even then, you will not get exactly the same results in different units. In fact, you will not get exactly the same results on all x87 devices. Despite the fact that these devices are compatible with the IEEE754 standard, this standard allows a certain freedom of action for calculations.
What's more, higher order computations, such as trigonometry, logarithms, exponentiation, etc., are performed very differently between 32 and 64 bits. A 32-bit block has more built-in functions than a 64-bit block. In the Delphi source code, you will notice that trigger functions, for example, are all implemented in RTL for 64 bits. In 32-bit code, they are implemented by calling x87 ops.
The bottom line is that you will never get your 32-bit and 64-bit programs to agree exactly when there are floating point calculations. You will have to accept differences in a small tolerance.
source share