Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

abs vs flabs


  • To: "James Crotinger" <jcrotinger@xxxxxxx>, "Jeffrey Oldham" <oldham@xxxxxxxxxxxxxxxx>, <pooma-dev@xxxxxxxxxxxxxxxxxxxxxx>
  • Subject: abs vs flabs
  • From: "Allan Stokes" <allan@xxxxxxxxx>
  • Date: Sat, 17 Mar 2001 00:10:23 -0800

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