Bug in mnbrak.cpp (fixed in v. 2.11)


Saul Teukolsky
09-16-2002, 09:13 AM
The line

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

should be

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

simoncoggins
05-23-2003, 05:28 AM
Does this bug exist in the C version as well?

Should this line:

SHFT(*bx,*cx,u,*cx+GOLD*(*cx-*bx))

be this instead:

SHFT(*bx,*cx,u,u+GOLD*(u-*cx))

Thanks,

Simon

Saul Teukolsky
05-26-2003, 01:19 PM
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

simoncoggins
05-27-2003, 04:26 AM
Ok, thanks very much.

Simon

grzes
07-13-2004, 03:32 AM
I was wondering whether the bug somehow also applies to mnbrak for pascal, verison 1.3?

Saul Teukolsky
07-13-2004, 08:32 AM
No, only in the C++ v 2.10.