[PATCH] Fix ceill() for ldbl-96
Andreas Jaeger
aj@suse.de
Fri Nov 14 06:51:00 GMT 2003
Is this patch now correct or not? The testcase I gave showed that it
fails ceill(0.25)...
Andreas
Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> writes:
> Hi,
>
> ceil(x) is defined so that ceil(x) = n / n - 1 < x <= n, where n is
> integral, x a real number. The following patch fixes this for ldbl-96
> targets (e.g. AMD64), in particular ceill(0.25).
>
> 2003-11-12 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
>
> * sysdeps/ieee754/ldbl-96/s_ceill.c (__ceill): Fix 0 < x < 1 case.
>
> --- glibc-2.3.2/sysdeps/ieee754/ldbl-96/s_ceill.c.ceill-fix 2000-10-01 00:01:23.000000000 +0200
> +++ glibc-2.3.2/sysdeps/ieee754/ldbl-96/s_ceill.c 2003-11-12 23:45:59.000000000 +0100
> @@ -50,9 +50,10 @@ static long double huge = 1.0e4930;
> j0 = (se&0x7fff)-0x3fff;
> if(j0<31) {
> if(j0<0) { /* raise inexact if x != 0 */
> - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
> - if(sx) {se=0x8000;i0=0;i1=0;}
> - else if((i0|i1)!=0) { se=0x3fff;i0=0;i1=0;}
> + if(huge+x>0.0) {
> + /* return -0.0 if -1 < x < 0, 1.0 if 0 < x < 1.0 */
> + if(sx) {se=0x8000;i0=0;i1=0;}
> + else if((i0|i1)!=0) { se=0x3fff;i0=0x80000000;i1=0;}
> }
> } else {
> i = (0x7fffffff)>>j0;
>
>
Andreas
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20031114/b6146263/attachment.sig>
More information about the Libc-alpha
mailing list