bug in gmp_printf (?)

Manuel Liedel Manuel.Liedel at gmx.de
Wed Aug 17 22:31:27 CEST 2011


Hi,

I get an error from gmp_printf which I do not understand. It relates to output of a number very close to one. The followig code produces an error:

#include <gmp.h>

using namespace std;

int main()
{

mpz_t test;
mpz_init(test);
mpz_set_str(test,"1208925819614629174706159",10);
mpf_t test_mpf;
mpf_init(test_mpf);

mpf_set_z(test_mpf,test);
mpf_div_2exp(test_mpf,test_mpf,80);

gmp_printf("\ntest=%Ff",test_mpf);
return 0;
}

It yields:

test=doprntf.c:128 GNU MP assertion failed: (p-)conv == 1 && p->prec > -1 ? ndigits >= ((1) > (exp + p->prec + 2) ? (exp + p->prec + 2)) : 1

If the output is set to hex, it works perfectly. gmp version is 5.0.2 on a 32-bit machine. For other numbers in the vicinity of "test" it sometime works (and sometimes not).

Regards

Manuel Liedel

PS. This is the second attempt to send this email today. Since it is (explicitely) plain-text now, it should hopefully be transmitted.
___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar


More information about the gmp-bugs mailing list