comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Floating-Point Numbers and Internal Representation
Date: Mon, 5 Dec 2005 18:54:15 -0800
Date: 2005-12-05T18:54:15-08:00	[thread overview]
Message-ID: <Au2dnfOXfqxqYQnenZ2dnUVZ_sadnZ2d@comcast.com> (raw)
In-Reply-To: dmutf4$gpt$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com

"Martin Dowie" <martin.dowie@btopenworld.com> 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)





  parent reply	other threads:[~2005-12-06  2:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-04 10:33 Floating-Point Numbers and Internal Representation Matthias Kretschmer
2005-12-04 11:12 ` Martin Krischik
2005-12-04 14:11   ` Martin Dowie
2005-12-04 14:50     ` Dmitry A. Kazakov
2005-12-04 15:15       ` Matthias Kretschmer
2005-12-04 18:14         ` Dmitry A. Kazakov
2005-12-04 21:16           ` Matthias Kretschmer
2005-12-06  2:54     ` Steve [this message]
2005-12-05 23:38   ` Randy Brukardt
2005-12-04 11:46 ` Dmitry A. Kazakov
2005-12-04 21:29 ` Gautier Write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox