* [PATCH] Fix ia64 feraiseexcept
@ 2007-05-08 21:30 Jakub Jelinek
2007-05-09 6:47 ` [PATCH] Fix ia64 feraiseexcept (take 2) Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2007-05-08 21:30 UTC (permalink / raw)
To: Ulrich Drepper, H. J. Lu; +Cc: Glibc hackers
Hi!
While feraiseexcept (FE_OVERFLOW); or feraiseexcept (FE_UNDERFLOW) are
allowed to raise additionally inexact exception, feraiseexcept (FE_INEXACT)
shouldn't raise any exception but inexact.
DBL_MAX + 1.0 overflows and is inexact though, while (DBL_MAX / 2.0) + 1.0
is only inexact, but doesn't overflow.
Fixes test-fenv.
2007-05-08 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Don't raise overflow
exception in addition to inexact when asked to raise only FE_INEXACT.
--- libc/sysdeps/ia64/fpu/fraiseexcpt.c.jj 2003-11-29 08:28:46.000000000 +0100
+++ libc/sysdeps/ia64/fpu/fraiseexcpt.c 2007-05-08 23:22:55.000000000 +0200
@@ -1,5 +1,6 @@
/* Raise given exceptions.
- Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002, 2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jes Sorensen <Jes.Sorensen@cern.ch>, 2000.
@@ -69,7 +70,7 @@ feraiseexcept (int excepts)
/* Last: inexact. */
if (FE_INEXACT & excepts)
{
- dummy = DBL_MAX;
+ dummy = DBL_MAX / 2.0;
__asm__ __volatile__ ("fadd.d.s0 %0=%1,f1" : "=f" (dummy) : "0" (dummy));
}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] Fix ia64 feraiseexcept (take 2)
2007-05-08 21:30 [PATCH] Fix ia64 feraiseexcept Jakub Jelinek
@ 2007-05-09 6:47 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2007-05-09 6:47 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
On Tue, May 08, 2007 at 11:38:15PM +0200, Jakub Jelinek wrote:
> While feraiseexcept (FE_OVERFLOW); or feraiseexcept (FE_UNDERFLOW) are
> allowed to raise additionally inexact exception, feraiseexcept (FE_INEXACT)
> shouldn't raise any exception but inexact.
>
> DBL_MAX + 1.0 overflows and is inexact though, while (DBL_MAX / 2.0) + 1.0
> is only inexact, but doesn't overflow.
Small correction, feraiseexcept without the patch misbehaves with fesetround
(FE_UPWARD) only, but IMHO it should be fixed even for that case.
Another alternative is to subtract f1 from DBL_MAX rather than add it,
which has the advantage that only 2 double constants are in .sdata rather
than 3 as with previous patch.
2007-05-09 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Don't raise overflow
exception in addition to inexact when asked to raise only FE_INEXACT.
--- libc/sysdeps/ia64/fpu/fraiseexcpt.c.jj 2003-11-29 08:28:46.000000000 +0100
+++ libc/sysdeps/ia64/fpu/fraiseexcpt.c 2007-05-09 08:38:43.000000000 +0200
@@ -1,5 +1,6 @@
/* Raise given exceptions.
- Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002, 2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jes Sorensen <Jes.Sorensen@cern.ch>, 2000.
@@ -70,7 +71,7 @@ feraiseexcept (int excepts)
if (FE_INEXACT & excepts)
{
dummy = DBL_MAX;
- __asm__ __volatile__ ("fadd.d.s0 %0=%1,f1" : "=f" (dummy) : "0" (dummy));
+ __asm__ __volatile__ ("fsub.d.s0 %0=%1,f1" : "=f" (dummy) : "0" (dummy));
}
/* Success. */
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-09 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-08 21:30 [PATCH] Fix ia64 feraiseexcept Jakub Jelinek
2007-05-09 6:47 ` [PATCH] Fix ia64 feraiseexcept (take 2) Jakub Jelinek
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).