RE: Bug with extended type?

Mike Bouffler <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <49F84FD1ADD9D311907500E018C244183CC75C@CARTMAN>
Why not just round off the extended version before assigning it to Result?

MikeB

> -----Original Message-----
> From: Allan Smith [mailto:[email protected]]
> Sent: 31 July 2003 23:51
> To: [email protected]
> Subject: Re: [Delphi] Bug with extended type?
> 
> 
> On Thu, 31 Jul 2003 21:25:39 -0000, michael_grimard wrote:
> 
> >I am suprised that ConvertVersionAsExtended(1, 20) returns 
> >1.19999999999999996 instead of 1.2, since it can (assign 1.2 in an 
> >extended variable and check with the debugger, you will see that the 
> >value of the variable is still 1.2).
> 
> Write 6/5 in binary and you get 1.00110011001100110011001100110011...
> that is to say the fraction can not be stored with absolute precision.
> 
> rather than a=b you should use abs(a-b) < delta (where delta 
> is an acceptable
> error) or a > b - delta etc
> -- 
> Regards,
> Allan Smith (Northwood, Middlesex, England)
> 
> ------------------------ Yahoo! Groups Sponsor 
> ---------------------~-->
> Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
> Printer at Myinks.com. Free s/h on orders $50 or more to the 
> US & Canada. http://www.c1tracking.com/l.asp?cid=5511
> http://us.click.yahoo.com/sO0ANB/LIdGAA/ySSFAA/i7folB/TM
> --------------------------------------------------------------
> -------~->
> 
> CodeCoffer - new Delphi code protection Tool!
> http://www.delphicollection.com/public/CodeCoffer.htm
> ---------------------------------------------------------------
> Unsubscribe:[email protected]
> List owner:[email protected]
> --------------------------------------------------------------- 
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sO0ANB/LIdGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.