From owner-freebsd-standards@FreeBSD.ORG Sun Dec 21 13:47:21 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA7C216A4CE for ; Sun, 21 Dec 2003 13:47:21 -0800 (PST) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA8A143D5D for ; Sun, 21 Dec 2003 13:47:16 -0800 (PST) (envelope-from kargl@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) hBLLlG5x028044 for ; Sun, 21 Dec 2003 13:47:16 -0800 (PST) (envelope-from kargl@troutmask.apl.washington.edu) Received: (from kargl@localhost)hBLLlGrr028043 for freebsd-standards@freebsd.org; Sun, 21 Dec 2003 13:47:16 -0800 (PST) (envelope-from kargl) From: "Steven G. Kargl" Message-Id: <200312212147.hBLLlGrr028043@troutmask.apl.washington.edu> To: freebsd-standards@freebsd.org Date: Sun, 21 Dec 2003 13:47:16 -0800 (PST) X-Mailer: ELM [version 2.4ME+ PL99f (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Subject: fenv.h implementation questions X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2003 21:47:21 -0000 Is the following a sufficient implementation of fenv.h? _fenv_t and _fexcept_t would be defined in machine/fenv.h, which I haven't implemented, yet. I'm assuming that these may be architecture specific (e.g., endianness). SuSv3 states that the exception and rounding mode macros are to be defined *if and only if* the implementation supports them. It also states that the function prototypes that I've include need to be specified. However, why would we need to specify, say, fegetround(), if the implementation doesn't support control of the rounding mode? Finally, how the heck do we implement the #pragma at the end? #ifndef _FENV_H_ #define _FENV_H_ #include #include typedef fenv_t _fenv_t; typedef fexcept_t _fexcept_t; #ifdef _EXCEPTIONS #define FE_DIVBYZERO 0x00000001 /* Divide by zero */ #define FE_INEXACT 0x00000002 /* Inexact flag raised */ #define FE_INVALID 0x00000004 /* Invalid operation */ #define FE_OVERFLOW 0x00000008 /* Overflow */ #define FE_UNDERFLOW 0x00000010 /* Underflow */ #define FE_ALL_EXCEPT 0x0000001F /* Bitwise-or of above flags */ #endif /* _EXCEPTIONS */ #ifdef _ROUNDING_MODES #define FE_DOWNWARD 0x00000020 /* Round downward */ #define FE_TONEAREST 0x00000040 /* Round to nearest */ #define FE_TOWARDZERO 0x00000080 /* Round towards zero */ #define FE_UPWARD 0x00000100 /* Round upwards */ #endif /* _ROUNDING_MODES */ #define FE_DFL_ENV (fenv_t const *) #if !defined(_FENV_INLINED_) __BEGIN_DECLS extern int feclearexcept(int); extern int fegetenv(fenv_t *); extern int fegetexceptflag(fexcept_t *, int); extern int fegetround(void); extern int feholdexcept(fenv_t *); extern int feraiseexcept(int); extern int fesetenv(const fenv_t *); extern int fesetexceptflag(const fexcept_t *, int); extern int fesetround(int); extern int fetestexcept(int); extern int feupdateenv(fenv_t *); __END_DECLS #endif /* !_FENV_INLINED_ */ #if 0 /* XXX Need to implement the FENV_ACCESS pragma */ #endif #endif /* _FENV_H_ */ -- Steve http://troutmask.apl.washington.edu/~kargl/