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 math/test-{ldouble,ildoubl} failures on s390{,x}, sparc{,64} and alpha
Date: Fri, 29 May 2009 17:11:00 -0000	[thread overview]
Message-ID: <20090529171130.GB3101@sunsite.ms.mff.cuni.cz> (raw)

Hi!

Similar patch to what Andreas posted for ppc long double, this time for IEEE
quad.  Tested on s390{,x}-linux.

2009-05-29  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ieee754/ldbl-128/s_expm1l.c: Include <errno.h>.
	(__expm1l): Set errno to ERANGE on overflow.
	* sysdeps/ieee754/ldbl-128/s_tanl.c: Include <errno.h>.
	(__tanl): Set errno to EDOM for ±Inf.
	* sysdeps/ieee754/ldbl-128/s_cosl.c: Include <errno.h>.
	(__cosl): Set errno to EDOM for ±Inf.
	* sysdeps/ieee754/ldbl-128/s_sinl.c: Include <errno.h>.
	(__sinl): Set errno to EDOM for ±Inf.

--- libc/sysdeps/ieee754/ldbl-128/s_expm1l.c.jj	2009-05-16 13:23:38.000000000 -0400
+++ libc/sysdeps/ieee754/ldbl-128/s_expm1l.c	2009-05-29 12:09:10.000000000 -0400
@@ -53,6 +53,7 @@
 
 
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -121,7 +122,10 @@ __expm1l (long double x)
 
   /* Overflow.  */
   if (x > maxlog)
-    return (big * big);
+    {
+      __set_errno (ERANGE);
+      return (big * big);
+    }
 
   /* Minimum value.  */
   if (x < minarg)
--- libc/sysdeps/ieee754/ldbl-128/s_tanl.c.jj	2009-05-16 13:23:38.000000000 -0400
+++ libc/sysdeps/ieee754/ldbl-128/s_tanl.c	2009-05-29 12:28:12.000000000 -0400
@@ -44,6 +44,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -65,7 +66,14 @@
 	if(ix <= 0x3ffe921fb54442d1LL) return __kernel_tanl(x,z,1);
 
     /* tanl(Inf or NaN) is NaN */
-	else if (ix>=0x7fff000000000000LL) return x-x;		/* NaN */
+	else if (ix>=0x7fff000000000000LL) {
+	    if (ix == 0x7fff000000000000LL) {
+		GET_LDOUBLE_LSW64(n,x);
+		if (n == 0)
+		    __set_errno (EDOM);
+	    }
+	    return x-x;		/* NaN */
+	}
 
     /* argument reduction needed */
 	else {
--- libc/sysdeps/ieee754/ldbl-128/s_cosl.c.jj	2009-05-16 13:23:38.000000000 -0400
+++ libc/sysdeps/ieee754/ldbl-128/s_cosl.c	2009-05-29 12:27:45.000000000 -0400
@@ -44,6 +44,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -66,7 +67,14 @@
 	  return __kernel_cosl(x,z);
 
     /* cos(Inf or NaN) is NaN */
-	else if (ix>=0x7fff000000000000LL) return x-x;
+	else if (ix>=0x7fff000000000000LL) {
+	    if (ix == 0x7fff000000000000LL) {
+		GET_LDOUBLE_LSW64(n,x);
+		if (n == 0)
+		    __set_errno (EDOM);
+	    }
+	    return x-x;
+	}
 
     /* argument reduction needed */
 	else {
--- libc/sysdeps/ieee754/ldbl-128/s_sinl.c.jj	2009-05-16 13:23:38.000000000 -0400
+++ libc/sysdeps/ieee754/ldbl-128/s_sinl.c	2009-05-29 12:27:27.000000000 -0400
@@ -44,6 +44,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -66,7 +67,14 @@
 	  return __kernel_sinl(x,z,0);
 
     /* sin(Inf or NaN) is NaN */
-	else if (ix>=0x7fff000000000000LL) return x-x;
+	else if (ix>=0x7fff000000000000LL) {
+	    if (ix == 0x7fff000000000000LL) {
+		GET_LDOUBLE_LSW64(n,x);
+		if (n == 0)
+		    __set_errno (EDOM);
+	    }
+	    return x-x;
+	}
 
     /* argument reduction needed */
 	else {

	Jakub

                 reply	other threads:[~2009-05-29 17:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090529171130.GB3101@sunsite.ms.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).