xref: /minix3/sys/arch/x86/include/ieeefp.h (revision 1cd76c751364e6270e8d5a0daebc6d3d169baf4d)
1*1cd76c75SBen Gras /*	$NetBSD: ieeefp.h,v 1.4 2011/03/26 19:52:20 christos Exp $	*/
2f6aac1c3SLionel Sambuc 
3f6aac1c3SLionel Sambuc /*
4f6aac1c3SLionel Sambuc  * Written by J.T. Conklin, Apr 6, 1995
5f6aac1c3SLionel Sambuc  * Public domain.
6f6aac1c3SLionel Sambuc  */
7f6aac1c3SLionel Sambuc 
8f6aac1c3SLionel Sambuc #ifndef _X86_IEEEFP_H_
9f6aac1c3SLionel Sambuc #define _X86_IEEEFP_H_
10f6aac1c3SLionel Sambuc 
11f6aac1c3SLionel Sambuc #include <sys/featuretest.h>
12f6aac1c3SLionel Sambuc #include <machine/fenv.h>
13f6aac1c3SLionel Sambuc 
14f6aac1c3SLionel Sambuc typedef int fp_except;
15f6aac1c3SLionel Sambuc #define FP_X_INV	FE_INVALID	/* invalid operation exception */
16f6aac1c3SLionel Sambuc #define FP_X_DNML	FE_DENORMAL	/* denormalization exception */
17f6aac1c3SLionel Sambuc #define FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
18f6aac1c3SLionel Sambuc #define FP_X_OFL	FE_OVERFLOW	/* overflow exception */
19f6aac1c3SLionel Sambuc #define FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
20f6aac1c3SLionel Sambuc #define FP_X_IMP	FE_INEXACT	/* imprecise (loss of precision) */
21f6aac1c3SLionel Sambuc 
22f6aac1c3SLionel Sambuc typedef enum {
23*1cd76c75SBen Gras 	FP_RN=FE_TONEAREST,		/* round to nearest representable num */
24f6aac1c3SLionel Sambuc 	FP_RM=FE_DOWNWARD,		/* round toward negative infinity */
25f6aac1c3SLionel Sambuc 	FP_RP=FE_UPWARD,		/* round toward positive infinity */
26f6aac1c3SLionel Sambuc 	FP_RZ=FE_TOWARDZERO		/* round to zero (truncate) */
27f6aac1c3SLionel Sambuc } fp_rnd;
28f6aac1c3SLionel Sambuc 
29*1cd76c75SBen Gras typedef enum {
30*1cd76c75SBen Gras 	FP_PS = 0,			/* 24 bit (single-precision) */
31*1cd76c75SBen Gras 	FP_PRS,				/* reserved */
32*1cd76c75SBen Gras 	FP_PD,				/* 53 bit (double-precision) */
33*1cd76c75SBen Gras 	FP_PE				/* 64 bit (extended-precision) */
34*1cd76c75SBen Gras } fp_prec;
35*1cd76c75SBen Gras 
36*1cd76c75SBen Gras 
37f6aac1c3SLionel Sambuc #endif /* _X86_IEEEFP_H_ */
38