xref: /openbsd/sys/arch/riscv64/include/ieeefp.h (revision 097a140d)
1 /*	$OpenBSD: ieeefp.h,v 1.1 2021/04/23 02:42:16 drahn Exp $	*/
2 /*	$NetBSD: ieeefp.h,v 1.1 2001/01/10 19:02:06 bjh21 Exp $	*/
3 
4 /*
5  * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
6  * Public domain.
7  */
8 
9 #ifndef _MACHINE_IEEEFP_H_
10 #define _MACHINE_IEEEFP_H_
11 
12 /* FP exception codes */
13 
14 #define FP_EXCEPT_INV	0
15 #define FP_EXCEPT_DZ	1
16 #define FP_EXCEPT_OFL	2
17 #define FP_EXCEPT_UFL	3
18 #define FP_EXCEPT_IMP	4
19 
20 /* Exception type (used by fpsetmask() et al.) */
21 
22 typedef int fp_except;
23 
24 /* Bit defines for fp_except */
25 
26 #define	FP_X_INV	(1 << FP_EXCEPT_INV)	/* invalid operation exception */
27 #define	FP_X_DZ		(1 << FP_EXCEPT_DZ)	/* divide-by-zero exception */
28 #define	FP_X_OFL	(1 << FP_EXCEPT_OFL)	/* overflow exception */
29 #define	FP_X_UFL	(1 << FP_EXCEPT_UFL)	/* underflow exception */
30 #define	FP_X_IMP	(1 << FP_EXCEPT_IMP)	/* imprecise (loss of precision; "inexact") */
31 #define FP_X_MASK	0x1f
32 
33 /* Rounding modes */
34 
35 typedef enum {
36     FP_RN=0,			/* round to nearest representable number */
37     FP_RP=1,			/* round toward positive infinity */
38     FP_RM=2,			/* round toward negative infinity */
39     FP_RZ=3			/* round to zero (truncate) */
40 } fp_rnd;
41 
42 #endif /* _MACHINE_IEEEFP_H_ */
43