xref: /illumos-gate/usr/src/uts/common/sys/ieeefp.h (revision 13b136d3061155363c62c9f6568d25b8b27da8f6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_IEEEFP_H
28 #define	_SYS_IEEEFP_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Sun types for IEEE floating point.
36  */
37 
38 #if defined(__sparc)
39 
40 enum fp_direction_type {	/* rounding direction */
41 	fp_nearest	= 0,
42 	fp_tozero	= 1,
43 	fp_positive	= 2,
44 	fp_negative	= 3
45 };
46 
47 enum fp_precision_type {	/* extended rounding precision */
48 	fp_extended	= 0,
49 	fp_single	= 1,
50 	fp_double	= 2,
51 	fp_precision_3	= 3
52 };
53 
54 enum fp_exception_type {	/* exceptions according to bit number */
55 	fp_inexact	= 0,
56 	fp_division	= 1,
57 	fp_underflow	= 2,
58 	fp_overflow	= 3,
59 	fp_invalid	= 4
60 };
61 #define	N_IEEE_EXCEPTION 5	/* Number of floating-point exceptions. */
62 
63 enum fp_trap_enable_type {	/* trap enable bits according to bit number */
64 	fp_trap_inexact	= 0,
65 	fp_trap_division	= 1,
66 	fp_trap_underflow	= 2,
67 	fp_trap_overflow	= 3,
68 	fp_trap_invalid	= 4
69 };
70 
71 #elif defined(__i386) || defined(__amd64)
72 
73 enum fp_direction_type {	/* rounding direction */
74 	fp_nearest	= 0,
75 	fp_negative	= 1,
76 	fp_positive	= 2,
77 	fp_tozero	= 3
78 };
79 
80 enum fp_precision_type {	/* extended rounding precision */
81 	fp_single	= 0,
82 	fp_precision_3	= 1,
83 	fp_double	= 2,
84 	fp_extended	= 3
85 };
86 
87 enum fp_exception_type {	/* exceptions according to bit number */
88 	fp_invalid	= 0,
89 	fp_denormalized	= 1,
90 	fp_division	= 2,
91 	fp_overflow	= 3,
92 	fp_underflow	= 4,
93 	fp_inexact	= 5
94 };
95 #define	N_IEEE_EXCEPTION 6	/* Number of floating-point exceptions. */
96 
97 enum fp_trap_enable_type {	/* trap enable bits according to bit number */
98 	fp_trap_invalid	= 0,
99 	fp_trap_denormalized	= 1,
100 	fp_trap_division	= 2,
101 	fp_trap_overflow	= 3,
102 	fp_trap_underflow	= 4,
103 	fp_trap_inexact	= 5
104 };
105 
106 #endif	/* __i386 || __amd64 */
107 
108 enum fp_class_type {		/* floating-point classes */
109 	fp_zero		= 0,
110 	fp_subnormal	= 1,
111 	fp_normal	= 2,
112 	fp_infinity	= 3,
113 	fp_quiet	= 4,
114 	fp_signaling	= 5
115 };
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _SYS_IEEEFP_H */
122