Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2001-04-04 13:11:51


I wonder how this should be handled.

Example: (poor implementation)

template<typename T>
inline T Limit (T x) {
  return (x == T(0)) ? T(0) : x / abs (x);
}

It would be better to test abs(x) < epsilon where epsilon might be
numeric_limits<T>::epsilon, or something to that effect.

But what if T is complex? One possibility is to specialize Limit for
the complex case. But is a more elegant approach possible? Should
complex have it's own numeric_limits?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk