Print this page
10495 libc should know how many FPU exceptions there are
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/floatingpoint.h
+++ new/usr/src/head/floatingpoint.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /* Copyright (C) 1989 AT&T */
22 22 /* All Rights Reserved */
23 23
24 24 /*
25 25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 26 */
27 27 /*
28 28 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
29 29 * Use is subject to license terms.
30 30 */
31 31
32 32 #ifndef _FLOATINGPOINT_H
33 33 #define _FLOATINGPOINT_H
34 34
35 35 #ifdef __STDC__
36 36 #include <stdio_tag.h>
37 37 #endif
38 38 #include <sys/ieeefp.h>
39 39
40 40 #ifdef __cplusplus
41 41 extern "C" {
42 42 #endif
43 43
44 44 /*
45 45 * <floatingpoint.h> contains definitions for constants, types, variables,
46 46 * and functions for:
47 47 * IEEE floating-point arithmetic base conversion;
48 48 * IEEE floating-point arithmetic modes;
49 49 * IEEE floating-point arithmetic exception handling.
50 50 */
51 51
52 52 #ifndef __P
53 53 #ifdef __STDC__
54 54 #define __P(p) p
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
55 55 #else
56 56 #define __P(p) ()
57 57 #endif
58 58 #endif /* !defined(__P) */
59 59
60 60 #if defined(__STDC__) && !defined(_FILEDEFED)
61 61 #define _FILEDEFED
62 62 typedef __FILE FILE;
63 63 #endif
64 64
65 -#define N_IEEE_EXCEPTION 5 /* Number of floating-point exceptions. */
66 -
67 65 typedef int sigfpe_code_type; /* Type of SIGFPE code. */
68 66
69 67 typedef void (*sigfpe_handler_type)(); /* Pointer to exception handler */
70 68
71 69 #define SIGFPE_DEFAULT (void (*)())0 /* default exception handling */
72 70 #define SIGFPE_IGNORE (void (*)())1 /* ignore this exception or code */
73 71 #define SIGFPE_ABORT (void (*)())2 /* force abort on exception */
74 72
75 73 extern sigfpe_handler_type sigfpe __P((sigfpe_code_type, sigfpe_handler_type));
76 74
77 75 /*
78 76 * Types for IEEE floating point.
79 77 */
80 78 typedef float single;
81 79
82 80 #ifndef _EXTENDED
83 81 #define _EXTENDED
84 82 typedef unsigned extended[3];
85 83 #endif
86 84
87 85 typedef long double quadruple; /* Quadruple-precision type. */
88 86
89 87 typedef unsigned fp_exception_field_type;
90 88 /*
91 89 * A field containing fp_exceptions OR'ed
92 90 * together.
93 91 */
94 92 /*
95 93 * Definitions for base conversion.
96 94 */
97 95 #define DECIMAL_STRING_LENGTH 512 /* Size of buffer in decimal_record. */
98 96
99 97 typedef char decimal_string[DECIMAL_STRING_LENGTH];
100 98 /* Decimal significand. */
101 99
102 100 typedef struct {
103 101 enum fp_class_type fpclass;
104 102 int sign;
105 103 int exponent;
106 104 decimal_string ds; /* Significand - each char contains an ascii */
107 105 /* digit, except the string-terminating */
108 106 /* ascii null. */
109 107 int more; /* On conversion from decimal to binary, != 0 */
110 108 /* indicates more non-zero digits following */
111 109 /* ds. */
112 110 int ndigits; /* On fixed_form conversion from binary to */
113 111 /* decimal, contains number of digits */
114 112 /* required for ds. */
115 113 } decimal_record;
116 114
117 115 enum decimal_form {
118 116 fixed_form, /* Fortran F format: ndigits specifies number */
119 117 /* of digits after point; if negative, */
120 118 /* specifies rounding to occur to left of */
121 119 /* point. */
122 120 floating_form /* Fortran E format: ndigits specifies number */
123 121 /* of significant digits. */
124 122 };
125 123
126 124 typedef struct {
127 125 enum fp_direction_type rd;
128 126 /* Rounding direction. */
129 127 enum decimal_form df; /* Format for conversion from binary to */
130 128 /* decimal. */
131 129 int ndigits; /* Number of digits for conversion. */
132 130 } decimal_mode;
133 131
134 132 enum decimal_string_form { /* Valid decimal number string formats. */
135 133 invalid_form, /* Not a valid decimal string format. */
136 134 whitespace_form, /* All white space - valid in Fortran! */
137 135 fixed_int_form, /* <digs> */
138 136 fixed_intdot_form, /* <digs>. */
139 137 fixed_dotfrac_form, /* .<digs> */
140 138 fixed_intdotfrac_form, /* <digs>.<frac> */
141 139 floating_int_form, /* <digs><exp> */
142 140 floating_intdot_form, /* <digs>.<exp> */
143 141 floating_dotfrac_form, /* .<digs><exp> */
144 142 floating_intdotfrac_form, /* <digs>.<digs><exp> */
145 143 inf_form, /* inf */
146 144 infinity_form, /* infinity */
147 145 nan_form, /* nan */
148 146 nanstring_form /* nan(string) */
149 147 };
150 148
151 149 extern void single_to_decimal __P((single *, decimal_mode *, decimal_record *,
152 150 fp_exception_field_type *));
153 151 extern void double_to_decimal __P((double *, decimal_mode *, decimal_record *,
154 152 fp_exception_field_type *));
155 153 extern void extended_to_decimal __P((extended *, decimal_mode *,
156 154 decimal_record *, fp_exception_field_type *));
157 155 extern void quadruple_to_decimal __P((quadruple *, decimal_mode *,
158 156 decimal_record *, fp_exception_field_type *));
159 157
160 158 extern void decimal_to_single __P((single *, decimal_mode *, decimal_record *,
161 159 fp_exception_field_type *));
162 160 extern void decimal_to_double __P((double *, decimal_mode *, decimal_record *,
163 161 fp_exception_field_type *));
164 162 extern void decimal_to_extended __P((extended *, decimal_mode *,
165 163 decimal_record *, fp_exception_field_type *));
166 164 extern void decimal_to_quadruple __P((quadruple *, decimal_mode *,
167 165 decimal_record *, fp_exception_field_type *));
168 166
169 167 extern void string_to_decimal __P((char **, int, int, decimal_record *,
170 168 enum decimal_string_form *, char **));
171 169 extern void func_to_decimal __P((char **, int, int, decimal_record *,
172 170 enum decimal_string_form *, char **,
173 171 int (*)(void), int *, int (*)(int)));
174 172 extern void file_to_decimal __P((char **, int, int, decimal_record *,
175 173 enum decimal_string_form *, char **,
176 174 FILE *, int *));
177 175
178 176 extern char *seconvert __P((single *, int, int *, int *, char *));
179 177 extern char *sfconvert __P((single *, int, int *, int *, char *));
180 178 extern char *sgconvert __P((single *, int, int, char *));
181 179 extern char *econvert __P((double, int, int *, int *, char *));
182 180 extern char *fconvert __P((double, int, int *, int *, char *));
183 181 extern char *gconvert __P((double, int, int, char *));
184 182 extern char *qeconvert __P((quadruple *, int, int *, int *, char *));
185 183 extern char *qfconvert __P((quadruple *, int, int *, int *, char *));
186 184 extern char *qgconvert __P((quadruple *, int, int, char *));
187 185
188 186 extern char *ecvt __P((double, int, int *, int *));
189 187 extern char *fcvt __P((double, int, int *, int *));
190 188 extern char *gcvt __P((double, int, char *));
191 189
192 190 #if __cplusplus >= 199711L
193 191 namespace std {
194 192 #endif
195 193 /*
196 194 * ANSI C Standard says the following entry points should be
197 195 * prototyped in <stdlib.h>. They are now, but weren't before.
198 196 */
199 197 extern double atof __P((const char *));
200 198 extern double strtod __P((const char *, char **));
201 199 #if __cplusplus >= 199711L
202 200 }
203 201
204 202 using std::atof;
205 203 using std::strtod;
206 204 #endif /* end of namespace std */
207 205
208 206 #ifdef __cplusplus
209 207 }
210 208 #endif
211 209
212 210 #endif /* _FLOATINGPOINT_H */
↓ open down ↓ |
136 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX