From: David Abrahams (dave_at_[hidden])
Date: 2005-06-08 11:49:24
Peder Holt <peder.holt_at_[hidden]> writes:
> On 6/8/05, David Abrahams <dave_at_[hidden]> wrote:
>> Peder Holt <peder.holt_at_[hidden]> writes:
> Currently, I use a naive approach, that does not handle rounding
> errors correctly for exponents.
> It goes something like this:
> #define REMOVE_EXP256(number) number*(number>1e256?1e-256:1.)
> #define REMOVE_EXP128(number) \
> etc etc
> #define REMOVE_EXP1(number)\
> And similar for negative exponents.
> After removing the exponent (normalising the number)
> I convert the number to int:
> #define BOOST_META_NORMALISED_DOUBLE_TO_INTA(value)
> #define BOOST_META_NORMALISED_DOUBLE_TO_INTB(value)
> As mentioned, since double is 2-based, the above approach gives
> round-off errors since it is 10-based.
> Replacing the above with a 2-based exponent seems to solve this problem
Maybe I'm missing something obvious, but I don't see how any of this
leads to compile-time constants. On a conforming compiler, a
calculation involving floating-point is not a compile-time constant.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk