Numerical Recipes Forum  

Go Back   Numerical Recipes Forum > Obsolete Editions Forum > General Hints, Tips, and Tricks for Using NR

Thread Tools Display Modes
Old 01-14-2004, 04:33 AM
lima lima is offline
Join Date: Jan 2004
Posts: 1
Question Floating point representations

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.

Reply With Quote
Old 01-14-2004, 10:29 AM
Saul Teukolsky Saul Teukolsky is offline
Numerical Recipes Author
Join Date: Jan 2002
Posts: 212
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
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 10:40 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.