comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Comparing Floating Point Values
Date: Wed, 13 Dec 2006 18:21:17 -0800
Date: 2006-12-13T18:21:17-08:00	[thread overview]
Message-ID: <YoCdnUX_BqgnKR3YnZ2dnUVZ_qK3nZ2d@comcast.com> (raw)
In-Reply-To: 1166026474.277616.267400@f1g2000cwa.googlegroups.com

"markp" <markwork66@yahoo.com> 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) 





  parent reply	other threads:[~2006-12-14  2:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13 16:14 Comparing Floating Point Values markp
2006-12-13 16:45 ` Adam Beneschan
2006-12-13 16:51 ` Ludovic Brenta
2006-12-13 20:02 ` Jeffrey R. Carter
2006-12-13 20:13 ` Gautier
2006-12-14  2:21 ` Steve [this message]
2006-12-14 22:22   ` Martin
replies disabled

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