[fpc-pascal] Floating point question
Bernd Oppolzer
bernd.oppolzer at t-online.de
Fri Feb 16 16:48:07 CET 2024
Am 16.02.2024 um 15:57 schrieb James Richters via fpc-pascal:
>> So you are saying when constant propagation is on, an expression should have a different result than with constant propagation off?
> The result of math when using constants MUST be the same as the result of identical math using variables.
>
> There should never be a difference if I did my formula with hard coded constants vs variables.
>
> Const_Ans = 2.00000010627116630224
> Const_Ans1 = 2.00000010627116630224
> Var_Ans1 = 2.00000000000000000000
>
> This should not be happening.
>
> James
See my other post;
if the developer explicitly wants reduced precision, then this is what
happens.
But the reduced precision should not come unexpectedly simply because the
compiler attaches type attributes to constants (which can't be easily
explained),
and then the outcome of simple decimal arithmetic is incorrect.
So I have to disagree, sorry.
More information about the fpc-pascal
mailing list