xref: /netbsd-src/sys/arch/ia64/include/ieeefp.h (revision b7d844764dd2eb8d8e0555313800bbc8dc931f06)
1*b7d84476Sscole /* $NetBSD: ieeefp.h,v 1.2 2017/02/23 02:03:27 scole Exp $ */
27d545240Smartin 
37d545240Smartin /*
47d545240Smartin  * Written by J.T. Conklin, Apr 28, 1995
57d545240Smartin  * Public domain.
67d545240Smartin  */
77d545240Smartin 
87d545240Smartin #ifndef _IA64_IEEEFP_H_
97d545240Smartin #define _IA64_IEEEFP_H_
107d545240Smartin 
117d545240Smartin #include <sys/featuretest.h>
127d545240Smartin 
137d545240Smartin #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
147d545240Smartin 
15*b7d84476Sscole #include <ia64/fenv.h>
167d545240Smartin 
177d545240Smartin /*
187d545240Smartin  * These bits match the fpcr as well as bits 12:11
197d545240Smartin  * in fp operate instructions
207d545240Smartin  */
21*b7d84476Sscole /* XXX remove since fenv.h now contains (but with different values)? */
22*b7d84476Sscole #if 0
237d545240Smartin #define	FE_TOWARDZERO	0	/* round to zero (truncate) */
247d545240Smartin #define	FE_DOWNWARD	1	/* round toward negative infinity */
257d545240Smartin #define	FE_TONEAREST	2	/* round to nearest representable number */
267d545240Smartin #define	FE_UPWARD	3	/* round toward positive infinity */
27*b7d84476Sscole #endif
287d545240Smartin 
297d545240Smartin #if !defined(_ISOC99_SOURCE)
307d545240Smartin 
317d545240Smartin typedef int fp_except;
327d545240Smartin 
337d545240Smartin #define	FP_X_INV	FE_INVALID	/* invalid operation exception */
347d545240Smartin #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
357d545240Smartin #define	FP_X_OFL	FE_OVERFLOW	/* overflow exception */
367d545240Smartin #define	FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
377d545240Smartin #define	FP_X_IMP	FE_INEXACT	/* imprecise (prec. loss; "inexact") */
387d545240Smartin #define	FP_X_IOV	FE_IOVERFLOW	/* integer overflow */
397d545240Smartin 
407d545240Smartin /*
417d545240Smartin  * fp_rnd bits match the fpcr, below, as well as bits 12:11
427d545240Smartin  * in fp operate instructions
437d545240Smartin  */
447d545240Smartin typedef enum {
457d545240Smartin     FP_RZ = FE_TOWARDZERO,	/* round to zero (truncate) */
467d545240Smartin     FP_RM = FE_DOWNWARD,	/* round toward negative infinity */
477d545240Smartin     FP_RN = FE_TONEAREST,	/* round to nearest representable number */
487d545240Smartin     FP_RP = FE_UPWARD,		/* round toward positive infinity */
497d545240Smartin     _FP_DYNAMIC=FP_RP
507d545240Smartin } fp_rnd;
517d545240Smartin 
527d545240Smartin #endif /* !_ISOC99_SOURCE */
537d545240Smartin 
547d545240Smartin #endif	/* _NETBSD_SOURCE || _ISOC99_SOURCE */
557d545240Smartin 
567d545240Smartin #endif /* _IA64_IEEEFP_H_ */
577d545240Smartin 
587d545240Smartin 
597d545240Smartin 
607d545240Smartin 
617d545240Smartin 
627d545240Smartin 
637d545240Smartin 
647d545240Smartin 
657d545240Smartin 
667d545240Smartin 
67