From: David Abrahams (dave_at_[hidden])
Date: 2005-06-11 01:08:18
Peder Holt <peder.holt_at_[hidden]> writes:
> On 6/10/05, David Abrahams <dave_at_[hidden]> wrote:
>> Peder Holt <peder.holt_at_[hidden]> writes:
>> >> c.f. http://gcc.gnu.org/ml/gcc/2005-01/msg01744.html
>> >> and the last two items here:
>> >> http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Deprecated-Features.html#Deprecated-Features
>> > Oh, well. Anyway, I have now uploaded a version of this to the vault:
>> > metamath.zip
>> > that is mpl-compliant and supports comparison and arithmetics with the
>> > same accuracy as normal double arithmetics. Does not support NaN.
>> Does it get around the comparison problem somehow?
>> I think the results when a floating point value is converted to an
>> integral that can't represent it are undefined (or something similar)
>> but at least most compilers won't stop you. You might try to do some
>> awful thing like transforming
>> a < b
>> long(b - a) > 0
> I am not quite sure I understand the problem correctly.
The problem is that a < b is not a compile-time constant when a and b
are floating. If you use such comparisons internally to your library,
it is nonportable.
> What I do is
> the following:
> So the comparison is not a very big problem.
I don't know what BOOST_DOUBLE_EVAL does, so that is opaque to me.
-- 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