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,37e5589e32d8f03f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.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: Mon, 05 Dec 2005 20:52:39 -0600 From: "Steve" Newsgroups: comp.lang.ada References: <1843142.NoXPLYbHQs@linux1.krischik.com> Subject: Re: Floating-Point Numbers and Internal Representation Date: Mon, 5 Dec 2005 18:54:15 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-poSMEfGPxPhEsyPQybqeRVTAxKlkFWciA5el+kuBa0Z6j8gOl1kFvBo61fyq/V98d5IwR8UVWII8uAh!hEX4/dstSp+igxiprFDXWWMKfKXjORY4VKR1X19fXc08DeBZT9GsgnE/S/lsTk5kkCQb4rjegpW6!dnbZF1moAYAGnQ== 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: g2news1.google.com comp.lang.ada:6743 Date: 2005-12-05T18:54:15-08:00 List-Id: "Martin Dowie" wrote in message news:dmutf4$gpt$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... > Martin Krischik wrote: >> Independent of CPU/Language used I would allways suggest to use >> >> abs (X - Y) < epsilon >> >> with a sufficient but not to small epsilon instead. > > Suggested reading: > > http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm > > There is more than one answer to this problem... > > Cheers > > -- Martin Interestingly enough I ran across this site a couple of months ago, and am using the AlmostEquals function in some C++ code. For Ada, I would think you could make use of the 'Adjacent attribute to achieve a similar result, but would be independent of the floating point representation. Steve (The Duck)