abs vs flabs

Allan Stokes allan at stokes.ca
Sat Mar 17 08:10:23 UTC 2001


Yes, Jim's comment is correct.  This is a case where C++ takes advantage of
operator overloading to define abs() separately for each of int, long,
float, double, and long double.  In C++ fabs and labs are unnecessary flesh.

Allan

> Utilities/RefCounting/RefCountedBlockPtr/RefCountedBlockPtrTest.cpp:
>
> * Change abs() to fabs() for floating point numbers.

Stroustrup says <cmath> and <math.h> are supposed to include

  double abs(double);

Is that not true.

  Jim





More information about the pooma-dev mailing list