xref: /illumos-gate/usr/src/uts/sparc/sys/fpu/ieee.h (revision 71269a2275bf5a143dad6461eee2710a344e7261)
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 (c) 1987 by Sun Microsystems, Inc.
24  *	All rights reserved.
25  */
26 
27 #ifndef	_SYS_FPU_IEEE_H
28 #define	_SYS_FPU_IEEE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS-4.0 1.4 */
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Sparc IEEE floating-point support PUBLIC include file.
38  */
39 
40 /*	PUBLIC TYPES 	*/
41 
42 /*
43  * IEEE Arithmetic types... numbered to correspond to fsr fields.
44  */
45 
46 /*
47  * rounding direction
48  */
49 enum fp_rounding_direction {
50 	fp_rd_nearest	= 0,
51 	fp_rd_zero	= 1,
52 	fp_rd_plus	= 2,
53 	fp_rd_minus	= 3
54 };
55 
56 /*
57  * extended rounding precision
58  */
59 enum fp_rounding_precision {
60 	fp_rp_extended	= 0,
61 	fp_rp_single	= 1,
62 	fp_rp_double	= 2,
63 	fp_rp_3		= 3
64 };
65 
66 /*
67  * exceptions according to cexc bit number
68  */
69 enum fp_exception_type {
70 	fp_inexact	= 0,
71 	fp_divide	= 1,
72 	fp_underflow	= 2,
73 	fp_overflow	= 3,
74 	fp_invalid	= 4
75 };
76 
77 /*
78  * floating-point classes according to fclass
79  */
80 enum fp_class_type {
81 	fp_zero		= 0,
82 	fp_normal	= 1,		/* Includes subnormal. */
83 	fp_infinity   	= 2,
84 	fp_nan		= 3,		/* Includes quiet and signaling NaN. */
85 };
86 
87 
88 /* PUBLIC GLOBAL VARIABLES */
89 
90 unsigned fp_accrued_exceptions;	/* Sticky accumulated exceptions. */
91 
92 
93 /* PUBLIC FUNCTIONS */
94 
95 #ifdef	__STDC__
96 
97 extern enum
98 fp_rounding_direction swap_rounding_direction(enum fp_rounding_direction);
99 
100 /* Change rounding mode; return previous. */
101 
102 extern int swap_accrued_exceptions(int);
103 
104 /* Change accrued exceptions; return previous. */
105 
106 #else	/* __STDC__ */
107 
108 extern enum fp_rounding_direction swap_rounding_direction(/* rd */);
109 /*	extern enum fp_rounding_direction rd;  */
110 
111 /* Change rounding mode; return previous. */
112 
113 extern int swap_accrued_exceptions(/* x */);
114 /*	int x; */
115 
116 /* Change accrued exceptions; return previous. */
117 
118 #endif	/* ! __STDC__ */
119 
120 #ifdef	__cplusplus
121 }
122 #endif
123 
124 #endif	/* _SYS_FPU_IEEE_H */
125