a concerned citizen a concerned citizen - 1 year ago 212
C++ Question

MPFR C++ Print floating point numbers like integers

Having just succeeded in compiling a program using MPFR C++ (1st time), I need to print out some fairly large numbers, but they only come out as engineering notations instead of the whole numbers. From what I read, the library is not optimized for (arbitrary) integers, so it's fine to use floating point numbers as integers, since they won't be having any decimals. I am only a beginner in C++, so I don't know my way through all the tools available, but is there a way to print out the (big) floating point numbers as if they were integers? As an example, instead of (say)

, print
. If I try
, I get
, which doesn't look any better.

Answer Source

MPFR C++ allows precise tuning of output format a la printf style (if standard C++ capabilities is not enough). Example:


Please refer to MPFR manual for format specification in brackets. Also you might check this question: http://stackoverflow.com/a/9627660/479995

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download