Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 2002 17:40:05 -0500
From:      Tadayuki OKADA <tadayuki.okada@windriver.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Tadayuki OKADA <tokada@isi.com>, standards@freebsd.org
Subject:   Re: _MULTI_LIBM
Message-ID:  <3C93C9C5.F085857A@windriver.com>
References:  <20020317001529.T30317-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans wrote:
> > BTW, why don't we just define math_errhandling, MATH_ERRNO and
> > MATH_ERREXCEPT in math.h for POSIX complience for now?
> > Or are we waiting for fenv.h?
> 
> I didn't know about math_errhandling, MATH_ERRNO or MATH_ERREXCEPT.
> They seem to be new in POSIX.1-2001 (they aren't in POSIX-1.1996 or
> C99).  math_errhandling seems to be settable by the implemenation only.
from POSIX.1-2001 Base Definitions Chapter13 Headers <math.h>:
The following macros shall expand to the integer constants 1 and 2,
respectively;
  MATH_ERRNO
  MATH_ERREXCEPT

The following macro shall expand to an expression that has type int
and the value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR
of both:
  math_errhandling

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
non-zero, the implementation shall define the macros FE_DIVBYZERO,
FE_INVALID, and FE_OVERFLOW in <fenv.h>.


> They are bugs in POSIX IMO.  C99 got rid of the broken-as-designed
> requirement to set errno, but POSIX increased it (in practice).
No, new POSIX just requires one of 'errno' or 'exception' error handling
must be present. You don't need to set 'errno', but then you have to
have exception handling defined in <fenv.h>.
I don't know if C99 mandates one of them to be present.


> I'm not sure if the application can set math_handling.
I think it can't. See quotation above.


> or MATH_ERREXCEPT being set (this means that math functions
> must cause exceptions as not permitted by C9*, but as FreeBSD
> on i386's used to do).
MATH_ERREXCEPT means you can use fp-exception facility
defined in <fenv.h>, so it's not inconsistent with C99.


Regards,
-- 
Tadayuki OKADA

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C93C9C5.F085857A>