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