The way how I create my mpf_class effects the result after a arithmetic operation

H8H h8h at dev-nu11.de
Thu Jan 29 00:37:15 UTC 2015


> Support for the GMP, MPFR, and MPC libraries are provided by gmpy2
> library which I maintain.

Sounds cool. So what do you think about this behaviour I described. I
mean python is in some ways very convenience but to create Decimal and
to have create them with a string and not a "short" double is some kind
of thing what can users screwed up for the first time.

On 29.01.2015 01:30, Case Van Horsen wrote:
> On Wed, Jan 28, 2015 at 2:02 PM, Hans Aberg <haberg-1 at telia.com> wrote:
>>
>>> On 28 Jan 2015, at 18:09, H8H <h8h at dev-nu11.de> wrote:
>>>
>>> I see that i.e. python has the same behaviour:
>>
>> That may be the case because they use the GMP, MPFR and MPC libraries! :-)
> The Decimal type in Python is a true radix-10 floating point type.
> Early versions were written in Python but later versions are
> implemented in C. 64-bit binary values are converted exactly by
> creating a result with 53 decimal digits of precision. If an
> representation error is introduced when the 64-bit value was created,
> it will be propagated to the Decimal value.
> 

> 
> casevh
> 


More information about the gmp-discuss mailing list