Discussion:
Formatted Output on Windows
Pavel Holoborodko
2011-10-31 02:59:42 UTC
Permalink
I've encountered strange behavior for this simple code (Windows, MPFR 3.1.0
/ 3.2.0 dev, compiled by msvc2010 using Brian Gladman's port):

mpfr_t t;
mpfr_set_default_prec(84); // approx. 25 decimal places
mpfr_init(t);
mpfr_set_str(t, "999.99999999999999999999", 10, MPFR_RNDN); // twenty '9'
after decimal point.
mpfr_printf("%.25RNg\n",t);
mpfr_printf("%.20RNg\n",t);

Which give output:

999.99999999999999999999
100

Could someone confirm this?

Thanks in advance,
Pavel Holoborodko.
Pavel Holoborodko
2011-10-31 06:22:04 UTC
Permalink
Clarification:
problem is that second mpfr_printf gives "100" instead of "1000".

On Mon, Oct 31, 2011 at 11:59 AM, Pavel Holoborodko
Post by Pavel Holoborodko
I've encountered strange behavior for this simple code (Windows, MPFR
mpfr_t t;
mpfr_set_default_prec(84); // approx. 25 decimal places
mpfr_init(t);
mpfr_set_str(t, "999.99999999999999999999", 10, MPFR_RNDN); // twenty '9'
after decimal point.
mpfr_printf("%.25RNg\n",t);
mpfr_printf("%.20RNg\n",t);
999.99999999999999999999
100
Could someone confirm this?
Thanks in advance,
Pavel Holoborodko.
Loading...