[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#302458: libc6-dev: ceill and floorl on amd64 return wrong result in (-1, 0)



Package: libc6-dev
Version: 2.3.2.ds1-20
Severity: important

   The long double c library functions ceill() and floorl() return the wrong
values for certain inputs on amd64.  For instance, floorl() fails on inputs between
-1 and 0.  The following code shows the problem.

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int
main ()
{
	long double x  = -0.9;
	long double px = 0.0;
	long double mx = 0.0;

	px = floorl (x);
	mx = x - px;
	
	printf ("%Lf - %Lf = %Lf\n", x, px, mx);

	return 0;
}


Output:
-0.900000 - -0.000000 = nan

The correct output should be
-0.900000 - -1.000000 = 0.100000

This has been fixed in redhat glibc-2.3.2-95.20.src.rpm
https://rhn.redhat.com/errata/RHBA-2004-143.html


-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.8.1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to POSIX)

Versions of packages libc6-dev depends on:
ii  libc6                2.3.2.ds1-20        GNU C Library: Shared libraries an
ii  linux-kernel-headers 2.5.999-test7-bk-17 Linux Kernel Headers for developme

-- no debconf information



Reply to: