[fpc-pascal] Floating point question
wkitty42 at windstream.net
wkitty42 at windstream.net
Sat Feb 17 13:00:55 CET 2024
On 2/16/24 9:57 AM, James Richters via fpc-pascal wrote:
>> 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.
i've been quietly reading this entire thread and wow... i mean i do fully
understand the situation and both sides of the problem... looking at the
numbers, alone, the difference hits me hard in my OCD and i do agree with the
assessment that max precision should be used for the const math and the result
reduced when possible... but then, on the other hand, it really really really
depends, _a lot_, on exactly /what/ is being calculated and what the numbers
represent...
for example, here on Earth, (7 decimal places) 0.0000001 degree latitude is
""only"" 1cm... (8 decimal places) 0.00000001 degree latitude is ""only"" 1mm...
longitude, on the other hand, is variable such that 7 decimal places at the
equator is the same as latitude but as you move toward the poles, it changes
such that 4 decimal places is 20cm...
for me, this can be important when it comes to placing scenery objects in a
"true to life" simulator of the Earth, its terrain, and building/object
placement... a building or road being 1cm out of position isn't noticeable...
even 20cm out of place isn't really noticeable...
if this math is being used for measuring parsecs, yeah, i don't think i want to
be on that space ship when it arrives at the wrong position in space... if this
math is being used to measure angstroms, yeah... it kinda of matters... if this
math is being used for cutting wood as a carpenter does, it doesn't matter so
much... so please, put some perspective on this problem...
i'll have to look at my code for calculating a satellite's position in space in
relation to Earth's center... especially depending on the satellite's altitude
above the Earth as the higher the satellite is, the further off position the
calculation could be... depending on what the calculation is being used for, it
could be the difference between a good pass of two satellites crossing paths or
it could be quite the ugly loss of two satellites plus a huge spew of debris
from their impact...
--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list where it belongs!*
More information about the fpc-pascal
mailing list