mpf_get_d_2exp ignores sign of input

Claude Heiland-Allen claude at mathr.co.uk
Tue Mar 7 11:50:41 UTC 2017


Greetings,

mpf_get_d_2exp() always returns a non-negative value, even for negative
input.  I think this is a bug.

The attached program exhibits the problem, tested with the GMP version
packaged by Debian Stretch:

$ apt-cache policy libgmp10
libgmp10:
  Installed: 2:6.1.2+dfsg-1
  Candidate: 2:6.1.2+dfsg-1
  Version table:
 *** 2:6.1.2+dfsg-1 500
        500 http://ftp.uk.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status

I browsed the development repository and the latest generic source seems
to miss taking the sign into account.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-6'
--with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++
--prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu-
--enable-shared --enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin
--enable-default-pie --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64
--with-arch-directory=amd64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib
--enable-objc-gc=auto --enable-multiarch --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170205 (Debian 6.3.0-6)

$ uname -a
Linux frappuccino 4.7.0-1-amd64 #1 SMP Debian 4.7.8-1 (2016-10-19)
x86_64 GNU/Linux

$ cat /proc/cpuinfo  | grep model\ name | uniq -c
      4 model name      : AMD Athlon(tm) II X4 640 Processor

I hope it can be fixed.  Thanks,


Claude
-- 
https://mathr.co.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpf_get_d_2exp_bug.c
Type: text/x-csrc
Size: 369 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20170307/55405ba9/attachment.bin>


More information about the gmp-bugs mailing list