Hi Rolf, hello Avra,
using Fix64 quite a while now, I found the following problem: The Source for "FloatToFix64" above and the build in function in the compiler give erratic results when working with very small negative values:
The code
Var
lFl1 : Float;
..
Begin
lFl1 := -0.00000000001;
SLIP_WriteStr('TXT|lFl1: '+FloatToStr(lFl1));
SLIP_WriteStr('TXT|FloatToFix64(lFl1): '+Fix64ToStr(FloatToFix64(lFl1)) );
...
End;
Will give the following result:
lFl1: -9.999992E-12
FloatToFix64(lFl1): -1.000000000
The FloatToFix64 conversion gives -1 !! I checked, it is not the Fix64ToStr Function. So, all calculation with very small negative Values, that are converted from FloatToFix64 go wrong.
Can you have a look? If you fix the issue, I would be glad, if you could post the corrected code for FloatToFix64 here, so I can prevent the "uses uFix64" clause (making my code too big)
Hope you can help!
Thanks, Michael
using Fix64 quite a while now, I found the following problem: The Source for "FloatToFix64" above and the build in function in the compiler give erratic results when working with very small negative values:
The code
Var
lFl1 : Float;
..
Begin
lFl1 := -0.00000000001;
SLIP_WriteStr('TXT|lFl1: '+FloatToStr(lFl1));
SLIP_WriteStr('TXT|FloatToFix64(lFl1): '+Fix64ToStr(FloatToFix64(lFl1)) );
...
End;
Will give the following result:
lFl1: -9.999992E-12
FloatToFix64(lFl1): -1.000000000
The FloatToFix64 conversion gives -1 !! I checked, it is not the Fix64ToStr Function. So, all calculation with very small negative Values, that are converted from FloatToFix64 go wrong.
Can you have a look? If you fix the issue, I would be glad, if you could post the corrected code for FloatToFix64 here, so I can prevent the "uses uFix64" clause (making my code too big)
Hope you can help!
Thanks, Michael