The way how I create my mpf_class effects the result after a arithmetic operation
Hans Aberg
haberg-1 at telia.com
Wed Jan 28 23:54:44 UTC 2015
> On 29 Jan 2015, at 00:30, H8H <h8h at dev-nu11.de> wrote:
>
>> In the 1990s, some C/C++ compilers were poor at translating floats at
> full precision, pi better implemented as say 4*atan(1).
>
> Yep thats right. Better to implemented pi with mpz_t objects.
>
> All i wanna do is to build a switch, so that the user hasn't care about
> the floating points and its limitations. If an arithmetic operation ends
> in an inf / nan / subnormal or whatever the tool recalc the operation
> with the mpf_class / mpf_* object.
Checks consume time, so best to have separate static (compiler time) types: double without checks, or GMP/MPFR for higher precision.
> The user has also the opportunity to
> set a precision, therefore the tool should use the mpf_class for the
> arithmetic operation directly. Furthermore every object (double or
> mpf_class) in the program i've build has its own precision (for doubles
> 52bits / for mpf_class the default or the one which was set).
If you can statically decide when to use a double, that would be different matter.
More information about the gmp-discuss
mailing list