Rostin
06-21-2007, 11:00 AM
I'm looking at the 2nd Edition of NR in C++ on pg 405.
Here's the portion of code I'm confused about.
fu = func(u);
if (fu < fc) {
shft3(bx, cx, u, u+GOLD*(u-cx));
shft3(fb, fc, fu, func(u));
}
Isn't the second call to shft3 equivalent to:
shft3(fb, fc, fu, fu);
I'm hesitant to call this a bug, but it seems to me that it should be
shft3(fb, fc, fu, func(u+GOLD*(u-cx));
Here's the portion of code I'm confused about.
fu = func(u);
if (fu < fc) {
shft3(bx, cx, u, u+GOLD*(u-cx));
shft3(fb, fc, fu, func(u));
}
Isn't the second call to shft3 equivalent to:
shft3(fb, fc, fu, fu);
I'm hesitant to call this a bug, but it seems to me that it should be
shft3(fb, fc, fu, func(u+GOLD*(u-cx));