my first code using GMP!

Torbjorn Granlund tg at gmplib.org
Wed May 30 23:45:06 CEST 2012


Pranav Jawale <pranavshriram at gmail.com> writes:

  Earlier I tried to use gmp_printf, but it was giving seg fault. I think
  this line
  
  gmp_printf ("fixed point mpf %.*Ff with %d digits\n", n, f, n);
  
  on http://www.gnu.org/software/gmp/manual/html_node/Formatted-Output-Strings.html
  is not working properly
  
If you think that, please write a complete example that we can run, and
report to or bug reporting list.  See the GMP manual for bug reporting
guidelines.

(If you took the code pattern very literally, and pasted it as if it
were a complete example, then the uninitialised f and n will surely
yield some surprises.)

  Anyway, just using %.*Ff is equivalent to what I had written code for.
  
Alas, I don't think it is.  It hopefully gets the exponent right, while
your code seem to have gotten it wrong.

-- 
Torbjörn


More information about the gmp-discuss mailing list