Boost logo

Boost :

Subject: Re: [boost] [Review Request] Multiprecision Arithmetic Library
From: Andrii Sydorchuk (sydorchuk.andriy_at_[hidden])
Date: 2012-04-08 06:40:30

> I believe the relative error in our basic operations is *less than* or
> equal
> to one ULP. However, in portable C++, we can not hack the floating-point
> type---never. One of our back ends has base-10. The other two have
> an intriguing combinations of base-2. The hacks of the internal details
> of these representations would not be portable.

I guess my statement was too ambiguous. I don't ask this functionality to
be accessible through generic mp_number interface, but via backend
interface of cpp_dec_float.

To test for relative (in)-equality within one ULP, you need to take the
> ratio of two quantities, subtract this ratio from 1 and subsequently
> take the absolute value of the result to obtain a basis for comparison
> with 1 ULP.

Approach you mentioned requires division and would be quite slow. It is a
lot faster to compare internal integer representations.

This is the normal way for any floating-point type. It is a lot to take at
> first.
> But no portable code can rely on the internal representation of the
> floating-point
> type. You can only use library functions, limits and/or comparison.

Ok, that's another way to go. It would be great to have ulp comparison
functionality as part of the library.
Particularly I am interested in the following prototype:
bool ulp_equal(const mp_number<fpt_type> &a, const mp_number<fpt_type> &b,
unsigned int ulps);


Unsubscribe & other changes:**

Boost list run by bdawes at, gregod at, cpdaniel at, john at