public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix next{after,toward}l on ppc*
Date: Sun, 01 Apr 2007 17:07:00 -0000	[thread overview]
Message-ID: <20070401171259.GF1826@sunsite.mff.cuni.cz> (raw)
In-Reply-To: <20070327131242.GD1826@sunsite.mff.cuni.cz>

On Tue, Mar 27, 2007 at 03:12:42PM +0200, Jakub Jelinek wrote:
> 2007-03-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	[BZ #3306]
> 	* math/math_private.h (math_opt_barrier, math_force_eval): Define.
...

Testing on ppc/ppc64 revealed one forgotten file in this patch, here it is
incrementally on top of the previously posted BZ#3306 patch.

2007-04-01  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Use
	math_opt_barrier and math_force_eval macros.

--- libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c.jj	2006-01-28 01:07:25.000000000 +0100
+++ libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c	2007-04-01 18:40:19.000000000 +0200
@@ -24,8 +24,8 @@ static char rcsid[] = "$NetBSD: $";
  *   Special cases:
  */
 
-#include "math.h"
-#include "math_private.h"
+#include <math.h>
+#include <math_private.h>
 #include <math_ldbl_opt.h>
 
 #ifdef __STDC__
@@ -53,9 +53,12 @@ static char rcsid[] = "$NetBSD: $";
 	if(x==y)
 	    return y;		/* x=y, return y */
 	if(ihx == 0 && ilx == 0) {			/* x == 0 */
+	    long double u;
 	    SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (u);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(ihx>=0) {			/* x > 0 */
 	    if(ihx>ihy||((ihx==ihy)&&(ilx>ily))) {	/* x > y, x -= ulp */
@@ -93,12 +96,9 @@ static char rcsid[] = "$NetBSD: $";
 	}
 	hy = hx&0x7ff0000000000000LL;
 	if(hy==0x7ff0000000000000LL) return x+x;/* overflow  */
-	if(hy==0) {				/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        SET_LDOUBLE_WORDS64(y,hx,lx);
-		return y;
-	    }
+	if(hy==0) {
+	    long double u = x * x;		/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_LDOUBLE_WORDS64(x,hx,lx);
 	return x;

	Jakub

      reply	other threads:[~2007-04-01 17:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 13:08 [PATCH] Fix next{after,toward}{,f,l} underflow (and overflow) handling Jakub Jelinek
2007-04-01 17:07 ` Jakub Jelinek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070401171259.GF1826@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).