Error in ran2() comment


spi
06-27-2002, 06:07 AM
In my humble opinion, there's a (very light) error in ran2() C function comment (in the margin) page 282.

When idum2 is computed, the comment says:
"Compute idum2 = IA2 * idum % IM2 likewise"

Code says (and it seems obvious) that
idum2 = IA2 * idum2 % IM2

Am I right ?

William Vetterling
07-02-2002, 08:23 AM
Yes, I would say so. That error in the comment appears in the C and C++ editions, but interestingly not in the Fortran-77.

Thanks for the tip!