[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mpz_ui_pow_ui
From: |
Winfried Dreckmann |
Subject: |
mpz_ui_pow_ui |
Date: |
Wed, 31 Mar 2004 12:49:26 +0200 |
User-agent: |
Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022 |
Hi,
The function "mpz_ui_pow_ui" returns the wrong result in certain corner
cases. For instance,
#include <stdio.h>
#include <gmp.h>
int main(int argc, char *argv[])
{
mpz_t x;
mpz_init(x);
mpz_ui_pow_ui(x, 4UL, 1431655766UL);
if (mpz_fits_ulong_p(x)) printf("x = %u\n", mpz_get_ui(x));
return 0;
}
prints "x = 4". There are many similar cases. The reason seems to be an
integer overflow during the computation of low zero bits in
"mpz/n_pow_ui.c".
gmp version: 4.1
machine: PowerPC 604e running Linux 2.2.14
compiler: gcc 2.95.2
Best regards,
Winfried Dreckmann
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mpz_ui_pow_ui,
Winfried Dreckmann <=