Saul Teukolsky
03-25-2002, 09:01 AM
The text of NR says that the C++ code was run with the GNU 2.95 compiler. Some clarification is in order. The problem is that g++ 2.95 (or 2.96) does not fully implement the C++ standard. To compile a number of the driver programs, one has to change
cout << fixed << ...
to
cout.setf(ios::fixed);
cout << ...
There is a similar problem with
cout << scientific
cout << showpos
cout << left
cout << right
Another problem with gcc is that it does not implement numeric_limits. This means one has to replace
#include <limits>
with the old style (and inferior)
#include <cfloat>
and then
numeric_limits<DP>::radix -> FLT_RADIX
numeric_limits<DP>::max_exponent -> DBL_MAX_EXP
numeric_limits<DP>::min() -> DBL_MIN
numeric_limits<DP>::epsilon() -> DBL_EPSILON
numeric_limits<DP>::max() -> DBL_MAX
However, starting with version 3.0, g++ implements all these features and no changes are necessary to get the drivers to compile.
cout << fixed << ...
to
cout.setf(ios::fixed);
cout << ...
There is a similar problem with
cout << scientific
cout << showpos
cout << left
cout << right
Another problem with gcc is that it does not implement numeric_limits. This means one has to replace
#include <limits>
with the old style (and inferior)
#include <cfloat>
and then
numeric_limits<DP>::radix -> FLT_RADIX
numeric_limits<DP>::max_exponent -> DBL_MAX_EXP
numeric_limits<DP>::min() -> DBL_MIN
numeric_limits<DP>::epsilon() -> DBL_EPSILON
numeric_limits<DP>::max() -> DBL_MAX
However, starting with version 3.0, g++ implements all these features and no changes are necessary to get the drivers to compile.