Numerical Recipes Forum  

Go Back   Numerical Recipes Forum > Numerical Recipes Official Announcements > Old Bug Reports (Obsolete Editions of NR)

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2002, 09:13 AM
Saul Teukolsky Saul Teukolsky is offline
Numerical Recipes Author
 
Join Date: Dec 2001
Posts: 211
Bug in mnbrak.cpp

The line

shft3(bx,cx,u,cx+GOLD*(cx-bx));

should be

shft3(bx,cx,u,u+GOLD*(u-cx));
Reply With Quote
  #2  
Old 05-23-2003, 05:28 AM
simoncoggins simoncoggins is offline
Member
 
Join Date: May 2003
Posts: 2
Does this bug exist in the C version as well?

Should this line:

Code:
SHFT(*bx,*cx,u,*cx+GOLD*(*cx-*bx))
be this instead:

Code:
SHFT(*bx,*cx,u,u+GOLD*(u-*cx))
Thanks,

Simon
Reply With Quote
  #3  
Old 05-26-2003, 01:19 PM
Saul Teukolsky Saul Teukolsky is offline
Numerical Recipes Author
 
Join Date: Dec 2001
Posts: 211
Hi Simon,

No, the C code is correct. The reason is that a macro works differently from a function call. In a macro, the current values of variables are used at each stage. In a function call, the arguments are each evaluated independently.

Regards,
Saul Teukolsky
Reply With Quote
  #4  
Old 05-27-2003, 04:26 AM
simoncoggins simoncoggins is offline
Member
 
Join Date: May 2003
Posts: 2
Ok, thanks very much.

Simon
Reply With Quote
  #5  
Old 07-13-2004, 03:32 AM
grzes grzes is offline
Member
 
Join Date: Jul 2004
Location: Valladolid, Spain
Posts: 1
MNbrak and brent in pascal, ver 1.3

I was wondering whether the bug somehow also applies to mnbrak for pascal, verison 1.3?


Last edited by grzes; 07-13-2004 at 06:20 AM.
Reply With Quote
  #6  
Old 07-13-2004, 08:32 AM
Saul Teukolsky Saul Teukolsky is offline
Numerical Recipes Author
 
Join Date: Dec 2001
Posts: 211
No, only in the C++ v 2.10.
Reply With Quote
Reply

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 02:53 AM.


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