C++ mpf_class Precision

Marc Glisse marc.glisse at normalesup.org
Tue Jun 2 02:38:21 CEST 2009


On Mon, 1 Jun 2009, Henry wrote:

> mpf_class x;
> x=1.234567891234567899052395;

This is a general C question. When the compiler sees 
1.234567891234567899052395, it thinks this is a double and rounds it 
accordingly. I think you actually want to go though a string:
x="1.23...";

In a few years, with C++0x, you may be able to write 1.234_mpf instead of 
mpf_class("1.234"), but that is still far away.

-- 
Marc Glisse


More information about the gmp-discuss mailing list