bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: math error reporting


From: Bruno Haible
Subject: Re: math error reporting
Date: Mon, 7 Nov 2011 00:23:55 +0100
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Paul Eggert wrote:
> > How does that sound? (It's a lot of work, I know.)
> 
> It sounds nice.  You're right that it's a lot of work, though.
> Is it worth the effort?  (Depends on the problem you want solved
> but I don't know what that is....)

The problem is that the way to test whether a math function ran into an
exceptional case is platform dependent. For example, after

  y = sqrt (x);

some platforms require

  if (isnan (y))

on others it's

  if (fetestexcept (FE_INVALID))

and on others it's

  if (errno == EDOM)

On some platforms, two or all three among these codes work. But none
of these three codes works on all platforms.

> Will the <fenv.h> replacement address the documented FLT_ROUNDS
> incompatibility between C99 and typical GNU platforms?

Yes, by making fegetround() available on all platforms, the problem
is addressed: We will be able to recommend to use the <fenv.h> API
everywhere.

Oh, btw, the FLT_ROUNDS incompatibility was not yet documented. Done
as follows:


2011-11-06  Bruno Haible  <address@hidden>

        Doc about floating-point and math API.
        * doc/posix-headers/float.texi: Mention problem with FLT_ROUNDS.
        * doc/posix-headers/math.texi: Mention problem with math_errhandling.

--- doc/posix-headers/float.texi.orig   Mon Nov  7 00:21:04 2011
+++ doc/posix-headers/float.texi        Mon Nov  7 00:21:00 2011
@@ -25,4 +25,8 @@
 
 Portability problems not fixed by Gnulib:
 @itemize
address@hidden
+The macro @code{FLT_ROUNDS} is a constant expression and does not represent
+the current rounding mode on some platforms:
+glibc 2.11, HP-UX 11, mingw.
 @end itemize
--- doc/posix-headers/math.texi.orig    Mon Nov  7 00:21:04 2011
+++ doc/posix-headers/math.texi Mon Nov  7 00:12:10 2011
@@ -32,4 +32,7 @@
 @item
 @code{NAN} is not a compile time constant with some compilers:
 OSF/1 with Compaq (ex-DEC) C 6.4.
address@hidden
+The macro or variable @code{math_errhandling} is not defined on some platforms:
+glibc 2.11, OpenBSD 4.9, NetBSD 5.1, UP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 
1.7.9, mingw, MSVC 9.
 @end itemize

-- 
In memoriam Louis Philippe d'Orléans 
<http://en.wikipedia.org/wiki/Louis_Philippe_II,_Duke_of_Orléans>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]