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

Torbjörn Granlund tg at gmplib.org
Wed Jan 28 17:21:01 UTC 2015


H8H <h8h at dev-nu11.de> writes:

  But could you tell me some use cases for which it is better to create a
  mpf_class from a double instead of creating it from a string to have a
  higher precision? Has it a better performance? Is it better for lower
  precisions?
  
Mainly for interoperability.  But it seems to be a source of recurrent
confusion, so perhaps we should have made it really irksome.  :-)

But then again, assigning "3.4" as a string to a low-precision mpf
number will not yield the result people might expect.

  For me it makes no sense to create a mpf_class from a double and have a
  very poor precision.
  
I agree it usually makes little sense.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list