Bug#788681: libc6: Function remquo() is broken
Package: libc6
Version: 2.19-19
Severity: normal
Dear Maintainer,
function remquo() in libm 64 bit is broken. You can proof this with the
following C code:
----
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, y, z;
int i;
x = 777777777777.0;
y = 5.0;
z = remquo(x, y, &i);
printf("remquo(%f, %f) = %f; q = %d\n", x, y, z, i);
return 0;
}
----
Calculating remquo() with:
x = 777777777777.0
y = 5.0
Correct values are:
rem = 2.0
quo = 155555555555 = 0x2437D568E3 = 0x3 (least low order bits)
----
libm 32 bit yields (gcc -O0 -m32 ... -lm):
rem = 2.0
quo = 3
This result is OK.
----
gcc 32/64 bit with builtin remquo() yields (gcc -O2 -m32 ... ):
rem = 2.0
quo = 936732899 = 0x37D568E3
This result is OK, but there are too many bits in quo. No matter...
----
libm 64 bit yields (gcc -O0 -m64 ... -lm):
rem = 777777777737.0
quo = 8
This result ist completely wrong!
-- System Information:
Debian Release: stretch/sid
APT prefers testing-proposed-updates
APT policy: (500, 'testing-proposed-updates'), (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Reply to: