xref: /onnv-gate/usr/src/head/float.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
23*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*0Sstevel@tonic-gate  * Use is subject to license terms.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ifndef _FLOAT_H
32*0Sstevel@tonic-gate #define	_FLOAT_H
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <sys/feature_tests.h>
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #ifdef	__cplusplus
39*0Sstevel@tonic-gate extern "C" {
40*0Sstevel@tonic-gate #endif
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate #if defined(__sparc)
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate #if defined(__STDC__)
45*0Sstevel@tonic-gate extern int __flt_rounds(void);
46*0Sstevel@tonic-gate #else	/* defined(__STDC__) */
47*0Sstevel@tonic-gate extern int __flt_rounds();
48*0Sstevel@tonic-gate #endif	/* defined(__STDC__) */
49*0Sstevel@tonic-gate #define	FLT_ROUNDS	__flt_rounds()
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate #else /* defined(__sparc) */
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate #if defined(__STDC__)
54*0Sstevel@tonic-gate extern int __fltrounds(void);
55*0Sstevel@tonic-gate #else	/* defined (__STDC__) */
56*0Sstevel@tonic-gate extern int __fltrounds();
57*0Sstevel@tonic-gate #endif	/* defined(__STDC__) */
58*0Sstevel@tonic-gate #if defined(__amd64)
59*0Sstevel@tonic-gate #define	FLT_ROUNDS	__fltrounds()
60*0Sstevel@tonic-gate #else	/* defined(__amd64) */
61*0Sstevel@tonic-gate extern int __flt_rounds;
62*0Sstevel@tonic-gate #define	FLT_ROUNDS	__flt_rounds
63*0Sstevel@tonic-gate #endif	/* defined(__amd64) */
64*0Sstevel@tonic-gate #endif /* defined(__sparc) */
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate /* Introduced in ISO/IEC 9899:1999 standard */
67*0Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_STDC_C99) || \
68*0Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
69*0Sstevel@tonic-gate #if defined(__FLT_EVAL_METHOD__)
70*0Sstevel@tonic-gate #define	FLT_EVAL_METHOD __FLT_EVAL_METHOD__
71*0Sstevel@tonic-gate #else
72*0Sstevel@tonic-gate #define	FLT_EVAL_METHOD	-1
73*0Sstevel@tonic-gate #endif /* defined(__FLT_EVAL_METHOD__) */
74*0Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_STDC_C99)... */
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate #define	FLT_RADIX	2
77*0Sstevel@tonic-gate #define	FLT_MANT_DIG	24
78*0Sstevel@tonic-gate #define	FLT_EPSILON	1.1920928955078125000000E-07F
79*0Sstevel@tonic-gate #define	FLT_DIG		6
80*0Sstevel@tonic-gate #define	FLT_MIN_EXP	(-125)
81*0Sstevel@tonic-gate #define	FLT_MIN		1.1754943508222875079688E-38F
82*0Sstevel@tonic-gate #define	FLT_MIN_10_EXP	(-37)
83*0Sstevel@tonic-gate #define	FLT_MAX_EXP	(+128)
84*0Sstevel@tonic-gate #define	FLT_MAX		3.4028234663852885981170E+38F
85*0Sstevel@tonic-gate #define	FLT_MAX_10_EXP	(+38)
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate #define	DBL_MANT_DIG	53
88*0Sstevel@tonic-gate #define	DBL_EPSILON	2.2204460492503130808473E-16
89*0Sstevel@tonic-gate #define	DBL_DIG		15
90*0Sstevel@tonic-gate #define	DBL_MIN_EXP	(-1021)
91*0Sstevel@tonic-gate #define	DBL_MIN		2.2250738585072013830903E-308
92*0Sstevel@tonic-gate #define	DBL_MIN_10_EXP	(-307)
93*0Sstevel@tonic-gate #define	DBL_MAX_EXP	(+1024)
94*0Sstevel@tonic-gate #define	DBL_MAX		1.7976931348623157081452E+308
95*0Sstevel@tonic-gate #define	DBL_MAX_10_EXP	(+308)
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate /* Introduced in ISO/IEC 9899:1999 standard */
98*0Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_STDC_C99) || \
99*0Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
100*0Sstevel@tonic-gate #if defined(__sparc)
101*0Sstevel@tonic-gate #define	DECIMAL_DIG	36
102*0Sstevel@tonic-gate #elif defined(__i386) || defined(__amd64)
103*0Sstevel@tonic-gate #define	DECIMAL_DIG	21
104*0Sstevel@tonic-gate #endif
105*0Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_STDC_C99)... */
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /* Follows IEEE standards for 80-bit floating point */
111*0Sstevel@tonic-gate #define	LDBL_MANT_DIG	64
112*0Sstevel@tonic-gate #define	LDBL_EPSILON	1.0842021724855044340075E-19L
113*0Sstevel@tonic-gate #define	LDBL_DIG	18
114*0Sstevel@tonic-gate #define	LDBL_MIN_EXP	(-16381)
115*0Sstevel@tonic-gate #define	LDBL_MIN	3.3621031431120935062627E-4932L
116*0Sstevel@tonic-gate #define	LDBL_MIN_10_EXP	(-4931)
117*0Sstevel@tonic-gate #define	LDBL_MAX_EXP	(+16384)
118*0Sstevel@tonic-gate #define	LDBL_MAX	1.1897314953572317650213E+4932L
119*0Sstevel@tonic-gate #define	LDBL_MAX_10_EXP	(+4932)
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate #elif defined(__sparc)
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate /* Follows IEEE standards for 128-bit floating point */
124*0Sstevel@tonic-gate #define	LDBL_MANT_DIG	113
125*0Sstevel@tonic-gate #define	LDBL_EPSILON	1.925929944387235853055977942584927319E-34L
126*0Sstevel@tonic-gate #define	LDBL_DIG	33
127*0Sstevel@tonic-gate #define	LDBL_MIN_EXP	(-16381)
128*0Sstevel@tonic-gate #define	LDBL_MIN	3.362103143112093506262677817321752603E-4932L
129*0Sstevel@tonic-gate #define	LDBL_MIN_10_EXP	(-4931)
130*0Sstevel@tonic-gate #define	LDBL_MAX_EXP	(+16384)
131*0Sstevel@tonic-gate #define	LDBL_MAX	1.189731495357231765085759326628007016E+4932L
132*0Sstevel@tonic-gate #define	LDBL_MAX_10_EXP	(+4932)
133*0Sstevel@tonic-gate 
134*0Sstevel@tonic-gate #else
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate #error "Unknown architecture!"
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate #endif
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate #ifdef	__cplusplus
142*0Sstevel@tonic-gate }
143*0Sstevel@tonic-gate #endif
144*0Sstevel@tonic-gate 
145*0Sstevel@tonic-gate #endif	/* _FLOAT_H */
146