[fpc-pascal] Floating point question

Thomas Kurz fpc.2021 at t-net.ruhr
Thu Feb 22 15:26:27 CET 2024


> 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...

My initial problem (i.e. why I asked the original question -- which I do regret meanwhile *g*) was that we do use floating-point numbers for date and time operations. (TDateTime = Double)

And I had discrepancies of about 40 seconds when converting between astronomical dates and TDateTime. This was how it all started...

We need approx. 5 decimals to represent one second (because the non-fractional part is considered being the day number). So "single" precision isn't acceptable here. If TDateTime were Unix-timestamp, it wouldn't matter. But since TDateTime is Julian day number (maybe with an offset, but that's irrelevant here), it unfortunately does matter.



More information about the fpc-pascal mailing list