Definitive errata for PBR program (hopefully)


I see several posts discussing the errata for the PBR program, but none of them really get it right. Rather than try to correct each one, this explanation will hopefully be definitive.

The program in the section “Writing pass-by-reference functions” (page 63 in the non-virtual book) contains the following errors:

  1. The call to cartesianToPolar( x, y, &angle, &radius ) has multiple errors. First, the x and y arguments are doubles, while the function’s arguments are floats. But, given the small values assigned to each variable, no real error occurs; this should probably result in a compiler warning, depending upon the compiler’s settings. More important, the &angle and &radius arguments are in the wrong order; they should be flipped to match the associated arguments in the cartesianToPolar() function.

  2. The final printf( …, x, y, radius, angle ); statement also has the radius and angle in the wrong order; they should be flipped.

Hopefully, this is the final answer on this topic. :smiley: