
Was this discussed before?
<cmath>
using namespace math::tools;
typedef double RealType; log_max_value<RealType>() 709 log(max_value<RealType>()) 709.783 !math::isinf(exp(log_max_value<RealType>())) //true
typedef long double RealType; log_max_value<RealType>() 11356 log(max_value<RealType>()) inf !math::isinf(exp(log_max_value<RealType>())) //false
i.e. exp in cmath seems to "assume" RealType = double.
i686-apple-darwin9-gcc-4.0.1
Nod, sadly there are some platforms where the long double overloads just forward to the double versions :-( It can lead to absurdities like the sqrt of a finite long double value coming back as infinity ! Boost.Math should define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS when this is the case: as it's basically impossible to reason sensibly about how long doubles will behave in such an environment. I'm surprised to see this occur on a 686 Mac though as I didn't think their std lib has this issue: could be a bug in std::log I guess that it can't handle std::numeric_limits<>::max() as an argument? HTH, John.