Re: error with "if" !!!
- From: dpb <bozarth.d@xxxxxxxxx>
- Date: 28 Apr 2007 07:06:48 -0700
On Apr 28, 3:52 am, nakisa <nakisa.noor...@xxxxxxxxx> wrote:
Hi ,everybody
I have encounter with strange error ( strange in my point view !)
In program, I need to find the sample values of function named f . I
use these 3 commands :
1) if (f<0.0005D0 ) then
2) if (abs(f-0.0005D0)<0.001D0) then
3) if (abs(f-0.0005D0)<0.01D0 ) then
to see the answer . I was surprised to see the answer of this commands
are different !
for example , 7.3124E-5 only given by second if !!
my question is what is the best way to find f near a number and why
the above commands give various answers
thanks
nakisa
The answer is inherent in the nature of floating point representation
-- see the following
http://docs.sun.com/source/806-3568/ncg_goldberg.html
.
- Follow-Ups:
- Re: error with "if" !!!
- From: glen herrmannsfeldt
- Re: error with "if" !!!
- From: Richard Maine
- Re: error with "if" !!!
- References:
- error with "if" !!!
- From: nakisa
- error with "if" !!!
- Prev by Date: Re: add a0 format to language to print trimmed character variables
- Next by Date: Re: MATMUL implementations
- Previous by thread: Re: error with "if" !!!
- Next by thread: Re: error with "if" !!!
- Index(es):
Relevant Pages
|
|