From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d402aef7676f64a5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 13 Dec 2006 20:19:38 -0600 From: "Steve" Newsgroups: comp.lang.ada References: <1166026474.277616.267400@f1g2000cwa.googlegroups.com> Subject: Re: Comparing Floating Point Values Date: Wed, 13 Dec 2006 18:21:17 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-zZIlEY9sEbrzjyekRDdoULOWUCRKlVTEf8txxhUIeJf+TlHztbYwsJEJO2MUTgil2LPi1GNzTfu/rGX!0dnjOG1YqyyibbNJKAmeiyFo/1b4/6CF12PolgOhwEgwO4RENiXge6wMJadGEVVFn++apWgh97tq!YAY59OuNWR3sQg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:7911 Date: 2006-12-13T18:21:17-08:00 List-Id: "markp" wrote in message news:1166026474.277616.267400@f1g2000cwa.googlegroups.com... >I was wondering if there was a convention for comparing 2 floats > dealing with significant digits. For example, if I had 2 variables (x > and y) and wanted to see if they were equal in an if statement, is > there a standard way to do a compare based on "x" significant digits? > > Thank you. > I am not aware of any standard way of doing this in Ada, but I did port some code from C to Ada that does the job for 32 bit IEEE 757 floating point values if you're interested. There is a good article on the subject at: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm Steve (The Duck)