Re: [fpc-pascal] time_fractionBetween bug?

2010-06-01 Thread Vinzent Höfler
Bee Jay bee.ogra...@gmail.com: [TDateTime] What if an app need a precise and correct result, say a rocket launcher? :D Is there other alternative solution? Yes. Use a time type based on a fixed point representation. This eliminates drift and accuracy issues cause by a floating point

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-31 Thread Bee Jay
On 30 Mei 2010, at 19:47, Jonas Maebe wrote: They should not be using any FPC functionality relying on floating point. Any person who uses floating point should know that by definition it is inexact (ranging from a little to enormously, depending on what you do). I understand. That last

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-31 Thread Bee Jay
But if I changed the milisecond part of a or b or both to anything but 0 then the result is correct. Correction... the bug arises NOT only if the msec part is 0. The bug arises if msec part of both variables are EQUAL. If they are different, at least 1 msec, then those functions produce

[fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Bee Jay
Hi all, Try the following code snippet: uses DateUtils; var a,b: TDateTime; i: integer; begin a := EncodeDateTime(2010, 1, 1, 0, 0, 0, 0); for i := 0 to 9 do begin b := EncodeDateTime(2010, 1, 1, 0, 0, i, 0); Writeln(SecondsBetween(a,b):3); end; end; I think the result

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Marco van de Voort
In our previous episode, Bee Jay said: Hi all, Try the following code snippet: uses DateUtils; var a,b: TDateTime; i: integer; begin a := EncodeDateTime(2010, 1, 1, 0, 0, 0, 0); for i := 0 to 9 do begin b := EncodeDateTime(2010, 1, 1, 0, 0, i, 0);

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Bee Jay
On 30 Mei 2010, at 19:18, Marco van de Voort wrote: IIRC this is normal and delphi compatible and due to TDatetime being a floating point type. No, it's not Delphi compatible. Delphi's result is alot worst, at least on Delphi 7. And I didn't ask to make it truly compatible with Delphi. ;)

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Jonas Maebe
On 30 May 2010, at 14:23, Bee Jay wrote: What if an app need a precise and correct result, say a rocket launcher? Then it shouldn't use floating point. Ever. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Bee Jay
On 30 Mei 2010, at 19:28, Jonas Maebe wrote: Then it shouldn't use floating point. Ever. Well... then it shouldn't be using FPC? ;) Ok, forget about the rocket launcher. The important note that I think need to be addressed is the bug only occurs if the milisecond part of a or b is 0. Other

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Jonas Maebe
On 30 May 2010, at 14:38, Bee Jay wrote: 2010, at 19:28, Jonas Maebe wrote: Then it shouldn't use floating point. Ever. Well... then it shouldn't be using FPC? ;) They should not be using any FPC functionality relying on floating point. Any person who uses floating point should know

Re: [fpc-pascal] time_fractionBetween bug?

2010-05-30 Thread Marco van de Voort
In our previous episode, Bee Jay said: Then it shouldn't use floating point. Ever. Well... then it shouldn't be using FPC? ;) This kind of problems are universal, and TDateTime is a library invention. If you have an integer date based library, you can use that instead. Ok, forget about the