mpf_integer_p() bug

Fred fkrenso at gmail.com
Mon Feb 18 06:36:53 CET 2008


Hello,

I am getting a problem when checking the result of a division of mpf_t
variables, and subsequently checking the result to see if it's an
integer.  At this point I'm pretty convinced that it's not some small
omission in the program, but if it is then I'm sorry to waste your time.

Here are the requested pieces of information:

1) GMP Version 4.2.2, packaged for fedora 8:

Installed Packages
gmp.i386         4.2.2-3.fc8            installed       
gmp.x86_64       4.2.2-3.fc8            installed       
gmp-devel.x86_64 4.2.2-3.fc8            installed       
gmp-devel.i386   4.2.2-3.fc8            installed       

2) Test program Attached as test.c
3) mpf_integer_p() returns 0 when it should not.  For instance,
performing 35.0/1.4, the result is 25.0.  The subsequent call to
mpf_integer_p() returns 0, which according to the documentation means
that the result is not an integer.
4) No crash occurs.
5) Fedora packaged GMP, I'm not sure what they configured it with when
it was built.
6) gcc version info:

Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c
++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)

7) uname -a output:

Linux localhost.localdomain 2.6.23.15-137.fc8 #1 SMP Sun Feb 10 17:03:13
EST 2008 x86_64 x86_64 x86_64 GNU/Linux

8) Sample output from the program using 35 as a test number (slightly
verbose, sorry...):

$./Decimals 35
Number Requested: 35

Square Root: 5.916080

Dividing by 1.1, is the result an integer?  0
Dividing by 1.2, is the result an integer?  0
Dividing by 1.3, is the result an integer?  0
Dividing by 1.4, is the result an integer?  0 (<-- should be > 0)
Dividing by 1.5, is the result an integer?  0
Dividing by 1.6, is the result an integer?  0
Dividing by 1.7, is the result an integer?  0
Dividing by 1.8, is the result an integer?  0
Dividing by 1.9, is the result an integer?  0
Dividing by 2.0, is the result an integer?  0
Dividing by 2.1, is the result an integer?  0
Dividing by 2.2, is the result an integer?  0
Dividing by 2.3, is the result an integer?  0
Dividing by 2.4, is the result an integer?  0
Dividing by 2.5, is the result an integer?  0 (<-- should be > 0)
Dividing by 2.6, is the result an integer?  0
Dividing by 2.7, is the result an integer?  0
Dividing by 2.8, is the result an integer?  0
Dividing by 2.9, is the result an integer?  0
Dividing by 3.0, is the result an integer?  0
Dividing by 3.1, is the result an integer?  0
Dividing by 3.2, is the result an integer?  0
Dividing by 3.3, is the result an integer?  0
Dividing by 3.4, is the result an integer?  0
Dividing by 3.5, is the result an integer?  0 (<-- Should be > 0)
Dividing by 3.6, is the result an integer?  0
Dividing by 3.7, is the result an integer?  0
Dividing by 3.8, is the result an integer?  0
Dividing by 3.9, is the result an integer?  0
Dividing by 4.0, is the result an integer?  0
Dividing by 4.1, is the result an integer?  0
Dividing by 4.2, is the result an integer?  0
Dividing by 4.3, is the result an integer?  0
Dividing by 4.4, is the result an integer?  0
Dividing by 4.5, is the result an integer?  0
Dividing by 4.6, is the result an integer?  0
Dividing by 4.7, is the result an integer?  0
Dividing by 4.8, is the result an integer?  0
Dividing by 4.9, is the result an integer?  0
Dividing by 5.0, is the result an integer?  0
Dividing by 5.1, is the result an integer?  0
Dividing by 5.2, is the result an integer?  0
Dividing by 5.3, is the result an integer?  0
Dividing by 5.4, is the result an integer?  0
Dividing by 5.5, is the result an integer?  0
Dividing by 5.6, is the result an integer?  0
Dividing by 5.7, is the result an integer?  0
Dividing by 5.8, is the result an integer?  0
Dividing by 5.9, is the result an integer?  0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 1174 bytes
Desc: not available
Url : http://gmplib.org/list-archives/gmp-bugs/attachments/20080218/300d44b8/attachment.bin 


More information about the gmp-bugs mailing list