From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27802 invoked by alias); 16 Jan 2010 18:47:36 -0000 Received: (qmail 27786 invoked by uid 22791); 16 Jan 2010 18:47:35 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Jan 2010 18:47:32 +0000 Received: from sunsite.mff.cuni.cz (localhost [127.0.0.1]) by sunsite.mff.cuni.cz (8.14.3/8.14.3) with ESMTP id o0GIlApt016617; Sat, 16 Jan 2010 19:47:10 +0100 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.14.3/8.14.3/Submit) id o0GIlAxw016615; Sat, 16 Jan 2010 19:47:10 +0100 Date: Sat, 16 Jan 2010 18:47:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] sysdeps/ieee754/ldbl-128/ fixes Message-ID: <20100116184710.GK2855@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00003.txt.bz2 Hi! I've noticed a couple of issues on s390x, this patch fixes them. The last change is to fix bug-nexttoward failure, the first two fix primarily warnings that a floating point constant exceeds range of double resp. long double. LDBL_MAX is 1.18973149535723176508575932662800702e+4932L, so 2e4932L is too big, and while 1e4930L fits into long double, 1e4930 doesn't fit into double and thus huge is infinity. Tested on s390x. 2010-01-16 Jakub Jelinek * sysdeps/ieee754/ldbl-128/s_ceill.c (huge): Add L suffix to the constant. * sysdeps/ieee754/ldbl-128/s_floorl.c (huge): Likewise. * sysdeps/ieee754/ldbl-128/s_expm1l.c (big): Decrease to avoid overflow. * sysdeps/ieee754/ldbl-128/s_log1pl.c (big): Remove unused variable. * sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf): Use math_opt_barrier and math_force_eval macros. --- libc/sysdeps/ieee754/ldbl-128/s_ceill.c.jj 2009-12-08 15:10:20.000000000 -0500 +++ libc/sysdeps/ieee754/ldbl-128/s_ceill.c 2010-01-16 13:03:34.664619692 -0500 @@ -30,9 +30,9 @@ static char rcsid[] = "$NetBSD: $"; #include "math_private.h" #ifdef __STDC__ -static const long double huge = 1.0e4930; +static const long double huge = 1.0e4930L; #else -static long double huge = 1.0e4930; +static long double huge = 1.0e4930L; #endif #ifdef __STDC__ --- libc/sysdeps/ieee754/ldbl-128/s_floorl.c.jj 2009-12-08 15:10:20.000000000 -0500 +++ libc/sysdeps/ieee754/ldbl-128/s_floorl.c 2010-01-16 13:03:56.564619148 -0500 @@ -30,9 +30,9 @@ static char rcsid[] = "$NetBSD: $"; #include "math_private.h" #ifdef __STDC__ -static const long double huge = 1.0e4930; +static const long double huge = 1.0e4930L; #else -static long double huge = 1.0e4930; +static long double huge = 1.0e4930L; #endif #ifdef __STDC__ --- libc/sysdeps/ieee754/ldbl-128/s_expm1l.c.jj 2009-12-08 15:10:20.000000000 -0500 +++ libc/sysdeps/ieee754/ldbl-128/s_expm1l.c 2010-01-16 13:04:52.614538123 -0500 @@ -86,7 +86,7 @@ static const long double /* ln (2^16384 * (1 - 2^-113)) */ maxlog = 1.1356523406294143949491931077970764891253E4L, /* ln 2^-114 */ - minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e4932L; + minarg = -7.9018778583833765273564461846232128760607E1L, big = 1e4932L; long double --- libc/sysdeps/ieee754/ldbl-128/s_log1pl.c.jj 2009-12-08 15:10:20.000000000 -0500 +++ libc/sysdeps/ieee754/ldbl-128/s_log1pl.c 2010-01-16 13:04:11.894616679 -0500 @@ -117,7 +117,6 @@ static const long double C2 = 1.42860682 static const long double sqrth = 0.7071067811865475244008443621048490392848L; /* ln (2^16384 * (1 - 2^-113)) */ static const long double maxlog = 1.1356523406294143949491931077970764891253E4L; -static const long double big = 2e4932L; static const long double zero = 0.0L; long double --- libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c.jj 2009-12-08 15:10:20.000000000 -0500 +++ libc/sysdeps/ieee754/ldbl-128/s_nexttowardf.c 2010-01-16 13:43:06.264598685 -0500 @@ -44,10 +44,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>48)-0x3f80 @@ -68,12 +70,9 @@ static char rcsid[] = "$NetBSD: $"; } hy = hx&0x7f800000; if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; Jakub