[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reldiff bug in GMP 4.1.2 unpatched (and also 4.1.3 unpatched)
From: |
abbott |
Subject: |
reldiff bug in GMP 4.1.2 unpatched (and also 4.1.3 unpatched) |
Date: |
Tue, 11 May 2004 14:00:19 +0200 (CEST) |
Hi,
VERBAL SUMMARY:
reldiff unexpectedly gives zero
PLATFORM
Linux point 2.4.22 #1 Thu Sep 11 12:43:28 UTC 2003 i686 unknown
COMPILER
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking
--with-gnu-ld --verbose --target=i386-slackware-linux
--host=i386-slackware-linux
Thread model: posix
gcc version 3.2.2
PROGRAM EXHIBITING BUG: (C++ source)
#include <gmp.h>
#include <iostream>
using namespace std;
int main()
{
mpf_t a, b, rd;
mpf_init2(a, 128); // ask for 128 bits' precision
mpf_init2(b, 128); // again
mpf_init2(rd, 8); // I don't need much precision here
mpf_set_ui(a, 1); // a = 1
mpf_set_ui(b, 1);
mpf_div_2exp(b, b, 65);
mpf_add(b, b, a); // b = 1 + 2^(-65)
mpf_reldiff(rd, a, b); // should be about 2^(-65), but gives zero
double mant;
long exp;
mant = mpf_get_d_2exp(&exp, rd);
cout << "reldiff is approx " << mant << " times 2^(" << exp << ")" << endl;
return 0;
}
- reldiff bug in GMP 4.1.2 unpatched (and also 4.1.3 unpatched),
abbott <=