Properly separate fenv.h and ieeefp.h by moving all fenv defines

over to the former.
Now that they are decoupled, make rounding modes match the hardware bits.
This commit is contained in:
martin 2015-01-13 11:15:29 +00:00
parent d5776d8163
commit 5b588e717d
2 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fenv.h,v 1.1 2014/12/27 16:54:03 martin Exp $ */
/* $NetBSD: fenv.h,v 1.2 2015/01/13 11:15:29 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -31,7 +31,23 @@
#define _HPPA_FENV_H_
#include <sys/stdint.h>
#include <machine/ieeefp.h>
typedef unsigned fenv_t;
typedef unsigned fexcept_t;
#define FE_INEXACT 0x01 /* imprecise (loss of precision) */
#define FE_UNDERFLOW 0x02 /* underflow exception */
#define FE_OVERFLOW 0x04 /* overflow exception */
#define FE_DIVBYZERO 0x08 /* divide-by-zero exception */
#define FE_INVALID 0x10 /* invalid operation exception */
#define FE_ALL_EXCEPT 0x1f
#define FE_TONEAREST (0) /* round to nearest representable number */
#define FE_TOWARDZERO (1<<9) /* round to zero (truncate) */
#define FE_UPWARD (2<<9) /* round toward positive infinity */
#define FE_DOWNWARD (3<<9) /* round toward negative infinity */
__BEGIN_DECLS

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieeefp.h,v 1.6 2015/01/12 09:14:45 mrg Exp $ */
/* $NetBSD: ieeefp.h,v 1.7 2015/01/13 11:15:29 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 6, 1995
@ -12,36 +12,20 @@
#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
typedef unsigned fenv_t;
typedef unsigned fexcept_t;
#define FE_INEXACT 0x01 /* imprecise (loss of precision) */
#define FE_UNDERFLOW 0x02 /* underflow exception */
#define FE_OVERFLOW 0x04 /* overflow exception */
#define FE_DIVBYZERO 0x08 /* divide-by-zero exception */
#define FE_INVALID 0x10 /* invalid operation exception */
#define FE_ALL_EXCEPT 0x1f
#define FE_TONEAREST 0 /* round to nearest representable number */
#define FE_TOWARDZERO 1 /* round to zero (truncate) */
#define FE_UPWARD 2 /* round toward positive infinity */
#define FE_DOWNWARD 3 /* round toward negative infinity */
#if !defined(_ISOC99_SOURCE)
typedef int fp_except;
#define FP_X_INV FE_INVALID /* invalid operation exception */
#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
#define FP_X_OFL FE_OVERFLOW /* overflow exception */
#define FP_X_UFL FE_UNDERFLOW /* underflow exception */
#define FP_X_IMP FE_INEXACT /* imprecise (loss of precision) */
#define FP_X_INV 0x10 /* invalid operation exception */
#define FP_X_DZ 0x08 /* divide-by-zero exception */
#define FP_X_OFL 0x04 /* overflow exception */
#define FP_X_UFL 0x02 /* underflow exception */
#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
typedef enum {
FP_RN=FE_TONEAREST, /* round to nearest representable number */
FP_RZ=FE_TOWARDZERO, /* round to zero (truncate) */
FP_RP=FE_UPWARD, /* round toward positive infinity */
FP_RM=FE_DOWNWARD /* round toward negative infinity */
FP_RN=0, /* round to nearest representable number */
FP_RZ=1, /* round to zero (truncate) */
FP_RP=2, /* round toward positive infinity */
FP_RM=3 /* round toward negative infinity */
} fp_rnd;
#endif /* !_ISOC99_SOURCE */