How To calculate/display large float numbers?

Torbjörn Granlund tg at gmplib.org
Sun Nov 27 11:54:23 UTC 2016


Jens Kallup <jkallup at web.de> writes:

  the following Code gives me always 0 - why?
  How can I say want = 12.30, and print the number?
  
Check the return value of mpq_init_set_str!  It will return an error
since GMP's rational conversions do now allow any floating point
numbers; write your number as 123/10.

(Allowing floating-point input strings would be a conceivable extension
here, since any finite string corresponds to a rational number.)

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


More information about the gmp-discuss mailing list