What is the correct syntax for using printf
and its cousins sprintf
and fprintf
to display the value of mpreal
-type variables? I have tried the naive casting to double:
printf ("... %g ...", (double) var);
only to receive this error message from g++:
error: invalid cast from type ‘mpfr::mpreal’ to type ‘double’
I had no problem using double
-type variables elsewhere on the program.
I heard about the type mpreal
as part of this library intended to enable the use of the usual binary operators to perform arbitrary precision arithmetic operations.