xref: /freebsd/sys/arm64/include/ieeefp.h (revision a0409676120c1e558d0ade943019934e0f15118d)
1 /*-
2  * Based on sys/sparc64/include/ieeefp.h
3  * Public domain.
4  * $FreeBSD$
5  */
6 
7 #ifndef _MACHINE_IEEEFP_H_
8 #define	_MACHINE_IEEEFP_H_
9 
10 /* Deprecated FPU control interface */
11 
12 /* FP exception codes */
13 #define	FP_EXCEPT_INV	8
14 #define	FP_EXCEPT_DZ	9
15 #define	FP_EXCEPT_OFL	10
16 #define	FP_EXCEPT_UFL	11
17 #define	FP_EXCEPT_IMP	12
18 #define	FP_EXCEPT_DNML	15
19 
20 typedef int fp_except_t;
21 
22 #define	FP_X_INV	(1 << FP_EXCEPT_INV)	/* invalid operation exception */
23 #define	FP_X_DZ		(1 << FP_EXCEPT_DZ)	/* divide-by-zero exception */
24 #define	FP_X_OFL	(1 << FP_EXCEPT_OFL)	/* overflow exception */
25 #define	FP_X_UFL	(1 << FP_EXCEPT_UFL)	/* underflow exception */
26 #define	FP_X_IMP	(1 << FP_EXCEPT_IMP)	/* imprecise (loss of precision) */
27 #define	FP_X_DNML	(1 << FP_EXCEPT_DNML)	/* denormal exception */
28 
29 typedef enum {
30 	FP_RN = (0 << 22),	/* round to nearest representable number */
31 	FP_RP = (1 << 22),	/* round toward positive infinity */
32 	FP_RM = (2 << 22),	/* round toward negative infinity */
33 	FP_RZ = (3 << 22)	/* round to zero (truncate) */
34 } fp_rnd_t;
35 
36 __BEGIN_DECLS
37 extern fp_rnd_t    fpgetround(void);
38 extern fp_rnd_t    fpsetround(fp_rnd_t);
39 extern fp_except_t fpgetmask(void);
40 extern fp_except_t fpsetmask(fp_except_t);
41 __END_DECLS
42 
43 #endif /* _MACHINE_IEEEFP_H_ */
44