standards/56906: Several math(3) functions fail to set errno on a domain error

Stefan Farfeleder stefan at fafoe.narf.at
Sat Mar 13 07:10:10 PST 2004


The following reply was made to PR standards/56906; it has been noted by GNATS.

From: Stefan Farfeleder <stefan at fafoe.narf.at>
To: Bruce Evans <bde at zeta.org.au>
Cc: bug-followup at freebsd.org
Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error
Date: Sat, 13 Mar 2004 16:09:10 +0100

 On Fri, Mar 12, 2004 at 11:21:41PM +1100, Bruce Evans wrote:
 
 > Committed with minor reordering.  I wasn't sure about the C99 visibility
 > ifdef because my (draft) copy of C99 doesn't have MATH_ERRO, but
 > POSIX.1-2001 doesn't say that it is an extension and glibc uses the same
 > ifdef, so I assumed that the ifdef is correct.
 
 Thanks, here's what the real C99 standard says:
 
 # 9 The macros
 #           MATH_ERRNO
 #           MATH_ERREXCEPT
 #   expand to the integer constants 1 and 2, respectively; the macro
 #           math_errhandling
 #   expands to an expression that has type int and the value MATH_ERRNO,
 #   MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
 #   constant for the duration of the program. It is unspecified whether
 #   math_errhandling is a macro or an identifier with external linkage. If a macro
 #   definition is suppressed or a program defines an identifier with the name
 #   math_errhandling, the behavior is undefined.  If the expression
 #   math_errhandling & MATH_ERREXCEPT can be nonzero, the implementation
 #   shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
 #   <fenv.h>.
 
 Sounds like we definitely have to support MATH_ERREXCEPT since we don't do
 MATH_ERRNO (I still think setting math_errhandling to 0 in the meantime is a
 good idea).
 
 BTW, I think the macros FP_*, HUGE_VAL{F,L}, INFINITY, NAN, fpclassify(), is*()
 and signbit(), and the types double_t and type_t should be protected by
 #if __ISO_C_VISIBLE >= 1999 too.  Similarly, lots of C99 prototypes aren't
 visible when__ISO_C_VISIBLE >= 1999.
 
 Cheers,
 Stefan


More information about the freebsd-standards mailing list