Floating point representations


lima
01-14-2004, 03:33 AM
Hi,
I was taking a look to the code of the function zbrent (Brent's method, Fortran 77 2nd ed.) and I saw this line of code:

if(abs(xm).le.tol1.or.fb.eq.0.) then

Shouldn't this type of expression be replaced to avoid strange results? Because of the comparison fb.eq.0.

Ricardo

Saul Teukolsky
01-14-2004, 09:29 AM
Hi Ricardo,

The method converges because of the first test. The test for fb.eq.0 is there only to take care of the special case when fb really is exactly zero.

Saul Teukolsky