Re: checking for close enough floating point values.
- From: Barry Schwarz <schwarzb@xxxxxxxx>
- Date: Sat, 31 May 2008 00:24:34 -0700
On Fri, 30 May 2008 02:07:53 -0700 (PDT), pereges <Broli00@xxxxxxxxx>
wrote:
On May 30, 9:52 am, Barry Schwarz <schwa...@xxxxxxxx> wrote:
This checks for a == b, not a >= b.
if (a + EPSILON >= b) would be the corresponding check for >=.
However, you should read 14.5 in the c-faq (www.c-faq.com) to see why
an unscaled EPSILON is a bad idea.
So do you think it will be better to use the relative difference
method as suggested in the C faq 14.5 ?
snip
Btw the floating point data that I'm reading has 6 places after the
decimal point so I though I would take a tolerance value of 0.000001.
If you can guarantee that all the data will be within a certain range
then you don't need to scale based on the current value. But what
happens when one set of values is near 1e-6 and another is near 1e10?
That is the point I thought the faq was trying to make.
Remove del for email
.
- References:
- checking for close enough floating point values.
- From: pereges
- Re: checking for close enough floating point values.
- From: Barry Schwarz
- Re: checking for close enough floating point values.
- From: pereges
- checking for close enough floating point values.
- Prev by Date: Re: Four or Two Bytes?
- Next by Date: Re: Four or Two Bytes?
- Previous by thread: Re: checking for close enough floating point values.
- Next by thread: Re: checking for close enough floating point values.
- Index(es):
Relevant Pages
|
|