[fpc-pascal] FPC GO32 2.6.2 wrong result from SecondsBetween
Lubomír Čabla
kladno at gmail.com
Tue Sep 17 20:51:30 CEST 2013
Yes, I know, you are right, so far I've used DOS utility GetDate/GetTime
without any errors.
I wanted to update the old compiler 1.x to the new version, but it seems
will stay with the old version.
Thank you for your help.
On Tue, Sep 17, 2013 at 8:31 PM, Tomas Hajny <XHajT03 at hajny.biz> wrote:
> On Tue, September 17, 2013 20:22, Lubomír Čabla wrote:
> > It may be, but I tried to use EncodeDateTime with the same result:
> >
> > DT1:=EncodeDateTime(2013,5,28,15,26,1,0);
> > DT2:=EncodeDateTime(2013,5,28,15,27,1,0);
> >
> > Function EncodeDateTime calls TryEncodeDateTime that uses TryEncodeDate
> > and
> > TryEncodeTime.
> >
> > This is only a test, I want to be sure that after comparing the two
> values
> > get the correct time difference and 59 seconds is not correct.
>
> As a principle, you can never avoid such errors if using floating point
> numbers. If you need absolutely precise results, use integers.
>
> Tomas
>
>
> >
> > On Tue, Sep 17, 2013 at 6:15 PM, Bart <bartjunk64 at gmail.com> wrote:
> >
> >> On 9/17/13, Lubomír Čabla <kladno at gmail.com> wrote:
> >> > I am doing something wrong?
> >>
> >> Probably rounding errors:
> >> DT1:=EncodeDate(2013,5,28)+EncodeTime(15,26,1,0);
> >> 2 calculations on floating numbers
> >>
> >> DT1:=EncodeTime(15,26,1,0);
> >> 1 calculation on floating numbers
> >>
> >> Bart
> >> _______________________________________________
> >> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >>
> > _______________________________________________
> > fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130917/473b8431/attachment.html>
More information about the fpc-pascal
mailing list