Boost logo

Boost :

From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2007-11-30 16:58:01


std::numeric_limits needs to be implemented for quantity. I think this
should work:

namespace std
{
   template< typename T, typename U >
   class numeric_limits< boost::units::quantity<U, T> > : public
numeric_limits<T>
   {
     typedef numeric_limits<T> type_limits;
     typedef boost::units::quantity<U, T> qty;
   public:
     static qty denorm_min() { return qty(type_limits::denorm_min() *
U()); }
     static qty epsilon() { return qty(type_limits::epsilon() * U()); }
     static qty infinity() { return qty(type_limits::infinity() * U()); }
     static qty max() { return qty(type_limits::max() * U()); }
     static qty min() { return qty(type_limits::min() * U()); }
     static qty round_error() { return qty(type_limits::round_error() *
U()); }
     static qty quiet_NaN() { return qty(type_limits::quiet_NaN() * U()); }
     static qty signalizing_NaN() { return
qty(type_limits::signaling_NaN() * U()); }
   };
}


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