mpz_divexact bug for PPC64

Leonardo Bianconi leonardo.bianconi at eldorado.org.br
Mon Sep 21 12:26:46 UTC 2015


Description: mpz_divexact has not the same result for PPC64, comparing with x86, when division is not exact.

GMP version: 6.0.0 installed by apt-get in Debian.

Test program:
----------------
#include <stdio.h>
#include <gmp.h>

int main(int argc, char *argv[])
{
  mpz_t a, b;
  mpz_init_set_str (a, "10", 0);
  mpz_init_set_str (b, "3", 0);

  mpz_divexact(a, a, b);

  printf("10 / 3 => %s\n", mpz_get_str (NULL, 0, a));
  return 0;
}
----------------
Compile command: gcc -o gmp_test gmp_test.c -lgmp -lm
----------------

Results:
PPC64: "10 / 3 => 3"
x86: "10 / 3 => 12297829382473034414"

uname -a
PPC64: Linux debian-std-le 3.16.0-4-powerpc64le #1 SMP Debian 3.16.7-ckt7-1 (2015-03-01) ppc64le GNU/Linux
x86: Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux


More information about the gmp-bugs mailing list