Another common issue I've had with doubles is x := 0
x = 0 can somtimes return false and the debugger might show 0.00000000001 or something as a value even though it was hardcoded. I now use routines like NearZero (just an example name) which rounds test values to a a reasonable test DP. On Wed, Dec 30, 2009 at 11:19 PM, Kyley Harris <ky...@harrissoftware.com>wrote: > Doubles and extendeds have always had minor rounding issues and other > little things depending on the OS, and Hardware that its running on. The > Currency is a special case which uses whole numbers rather than fractions > for arithmetic. Its supposed to be guaranteed accurate to 4dp and they are > not processed in the same way. > > > On Wed, Dec 30, 2009 at 9:42 PM, Vikas... <vikas.im...@gmail.com> wrote: > >> Hi Edward, >> >> I use extended for both. >> >> does it cause problem? >> >> >> On Wed, Dec 30, 2009 at 1:24 PM, Edward Koryagin >> <ed_iv2...@yahoo.co.nz>wrote: >> >>> Use currency and everything should be fine. >>> >>> Edward Koryagin >>> >>> >>> --- On Wed, 30/12/09, Edward Koryagin <ed_iv2...@yahoo.co.nz> wrote: >>> >>> > From: Edward Koryagin <ed_iv2...@yahoo.co.nz> >>> > Subject: Re: [DUG] Need help with trunc command delphi 6 >>> > To: "NZ Borland Developers Group - Delphi List" <delphi@delphi.org.nz> >>> > Received: Wednesday, 30 December, 2009, 8:28 PM >>> > What data types do you use for 4.5 >>> > and 0.1? >>> > >>> > Edward Koryagin >>> > >>> > >>> > --- On Wed, 30/12/09, Vikas... <vikas.im...@gmail.com> >>> > wrote: >>> > >>> > > From: Vikas... <vikas.im...@gmail.com> >>> > > Subject: [DUG] Need help with trunc command delphi 6 >>> > > To: delphi@delphi.org.nz >>> > > Received: Wednesday, 30 December, 2009, 8:00 PM >>> > > Hello everyone, >>> > > >>> > > I am facing one strange problem here. We are using a >>> > > banking teller application ,here we do calculation >>> > based on >>> > > denominations in short. >>> > > >>> > > My main problem is when we use this application for >>> > long >>> > > time with out closing it the trunc start giving >>> > incorrect >>> > > value what i mean is >>> > > >>> > > >>> > > quantity := trunc(amount/value). >>> > > >>> > > Sometime when amount = let say 4.5 and value =0.1 it >>> > gives >>> > > like >>> > > >>> > > quantity := trunc(4.5/0.1)=44 which is wrong since my >>> > > client complain it make them lose of 1 dollar amount. >>> > > >>> > > >>> > > However when i close the application and do again all >>> > works >>> > > fine. >>> > > >>> > > Anyone ever faced this problem before , or anyone >>> > know >>> > > any substitute for trunc which works >>> > > I am using delhi6 >>> > > >>> > > Appreciate your help >>> > > >>> > > >>> > > regards >>> > > vik >>> > > >>> > > -- >>> > > vikas >>> > > >>> > > >>> > > -----Inline Attachment Follows----- >>> > > >>> > > _______________________________________________ >>> > > NZ Borland Developers Group - Delphi mailing list >>> > > Post: delphi@delphi.org.nz >>> > > Admin: http://delphi..org.nz/mailman/listinfo/delphi >>> > > Unsubscribe: send an email to delphi-requ...@delphi.org.nz >>> > > with Subject: unsubscribe >>> > >>> > >>> > >>> > >>> > >>> > _______________________________________________ >>> > NZ Borland Developers Group - Delphi mailing list >>> > Post: delphi@delphi.org.nz >>> > Admin: http://delphi.org.nz/mailman/listinfo/delphi >>> > Unsubscribe: send an email to delphi-requ...@delphi.org.nz >>> > with Subject: unsubscribe >>> > >>> >>> >>> >>> >>> >>> _______________________________________________ >>> NZ Borland Developers Group - Delphi mailing list >>> Post: delphi@delphi.org.nz >>> Admin: http://delphi.org.nz/mailman/listinfo/delphi >>> Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: >>> unsubscribe >>> >> >> >> >> -- >> vikas >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: delphi@delphi.org.nz >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: >> unsubscribe >> > > > > -- > Kyley Harris > Harris Software > +64-21-671-821 > -- Kyley Harris Harris Software +64-21-671-821
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe