Boost logo

Boost :

Subject: Re: [boost] [Review Request] Multiprecision Arithmetic Library
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-04-08 05:11:28


>>From a brief view on your implementation it seems that there is no way to
> get access to the internal data, exp, neg, fpclass members.
> Am I right? Could you expose those as readonly through a const accessor
> methods?
> I need this functionality to be able to compare two floating point values
> within specified ulp range (units in the last place).

We can never expose internal details as such.... since they're details and
change from backend to backend. But:

exponent - available via frexp, cheap for binary types, expensive for
decimal types.
neg - Use mp_number::sign(). Comparison with a literal 0 is cheap too
(optimized in terms of sign()).
fpclass - use boost::math::fpclassify - it's as cheap as it's going to get
for that operation.

In other words, use the same operations you would as with a builtin floating
point type.

HTH, John.


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