xref: /arm-trusted-firmware/include/lib/libc/aarch64/float.h (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*-
2*91f16700Schasinglulu  * Copyright (c) 1989 Regents of the University of California.
3*91f16700Schasinglulu  * All rights reserved.
4*91f16700Schasinglulu  *
5*91f16700Schasinglulu  * Redistribution and use in source and binary forms, with or without
6*91f16700Schasinglulu  * modification, are permitted provided that the following conditions
7*91f16700Schasinglulu  * are met:
8*91f16700Schasinglulu  * 1. Redistributions of source code must retain the above copyright
9*91f16700Schasinglulu  *    notice, this list of conditions and the following disclaimer.
10*91f16700Schasinglulu  * 2. Redistributions in binary form must reproduce the above copyright
11*91f16700Schasinglulu  *    notice, this list of conditions and the following disclaimer in the
12*91f16700Schasinglulu  *    documentation and/or other materials provided with the distribution.
13*91f16700Schasinglulu  * 3. Neither the name of the University nor the names of its contributors
14*91f16700Schasinglulu  *    may be used to endorse or promote products derived from this software
15*91f16700Schasinglulu  *    without specific prior written permission.
16*91f16700Schasinglulu  *
17*91f16700Schasinglulu  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18*91f16700Schasinglulu  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*91f16700Schasinglulu  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*91f16700Schasinglulu  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21*91f16700Schasinglulu  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*91f16700Schasinglulu  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*91f16700Schasinglulu  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*91f16700Schasinglulu  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*91f16700Schasinglulu  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*91f16700Schasinglulu  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*91f16700Schasinglulu  * SUCH DAMAGE.
28*91f16700Schasinglulu  *
29*91f16700Schasinglulu  *	from: @(#)float.h	7.1 (Berkeley) 5/8/90
30*91f16700Schasinglulu  * $FreeBSD$
31*91f16700Schasinglulu  */
32*91f16700Schasinglulu 
33*91f16700Schasinglulu #ifndef _MACHINE_FLOAT_H_
34*91f16700Schasinglulu #define	_MACHINE_FLOAT_H_
35*91f16700Schasinglulu 
36*91f16700Schasinglulu #include <sys/cdefs.h>
37*91f16700Schasinglulu 
38*91f16700Schasinglulu __BEGIN_DECLS
39*91f16700Schasinglulu extern int __flt_rounds(void);
40*91f16700Schasinglulu __END_DECLS
41*91f16700Schasinglulu 
42*91f16700Schasinglulu #define	FLT_RADIX	2		/* b */
43*91f16700Schasinglulu #define	FLT_ROUNDS	__flt_rounds()
44*91f16700Schasinglulu #if __ISO_C_VISIBLE >= 1999
45*91f16700Schasinglulu #define	FLT_EVAL_METHOD	0
46*91f16700Schasinglulu #define	DECIMAL_DIG	17		/* max precision in decimal digits */
47*91f16700Schasinglulu #endif
48*91f16700Schasinglulu 
49*91f16700Schasinglulu #define	FLT_MANT_DIG	24		/* p */
50*91f16700Schasinglulu #define	FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */
51*91f16700Schasinglulu #define	FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */
52*91f16700Schasinglulu #define	FLT_MIN_EXP	(-125)		/* emin */
53*91f16700Schasinglulu #define	FLT_MIN		1.17549435E-38F	/* b**(emin-1) */
54*91f16700Schasinglulu #define	FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */
55*91f16700Schasinglulu #define	FLT_MAX_EXP	128		/* emax */
56*91f16700Schasinglulu #define	FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */
57*91f16700Schasinglulu #define	FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */
58*91f16700Schasinglulu #if __ISO_C_VISIBLE >= 2011
59*91f16700Schasinglulu #define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */
60*91f16700Schasinglulu #define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */
61*91f16700Schasinglulu #define	FLT_HAS_SUBNORM	1
62*91f16700Schasinglulu #endif /* __ISO_C_VISIBLE >= 2011 */
63*91f16700Schasinglulu 
64*91f16700Schasinglulu #define	DBL_MANT_DIG	53
65*91f16700Schasinglulu #define	DBL_EPSILON	2.2204460492503131E-16
66*91f16700Schasinglulu #define	DBL_DIG		15
67*91f16700Schasinglulu #define	DBL_MIN_EXP	(-1021)
68*91f16700Schasinglulu #define	DBL_MIN		2.2250738585072014E-308
69*91f16700Schasinglulu #define	DBL_MIN_10_EXP	(-307)
70*91f16700Schasinglulu #define	DBL_MAX_EXP	1024
71*91f16700Schasinglulu #define	DBL_MAX		1.7976931348623157E+308
72*91f16700Schasinglulu #define	DBL_MAX_10_EXP	308
73*91f16700Schasinglulu #if __ISO_C_VISIBLE >= 2011
74*91f16700Schasinglulu #define	DBL_TRUE_MIN	4.9406564584124654E-324
75*91f16700Schasinglulu #define	DBL_DECIMAL_DIG	17
76*91f16700Schasinglulu #define	DBL_HAS_SUBNORM	1
77*91f16700Schasinglulu #endif /* __ISO_C_VISIBLE >= 2011 */
78*91f16700Schasinglulu 
79*91f16700Schasinglulu #define	LDBL_MANT_DIG	113
80*91f16700Schasinglulu #define	LDBL_EPSILON	1.925929944387235853055977942584927319E-34L
81*91f16700Schasinglulu #define	LDBL_DIG	33
82*91f16700Schasinglulu #define	LDBL_MIN_EXP	(-16381)
83*91f16700Schasinglulu #define	LDBL_MIN	3.362103143112093506262677817321752603E-4932L
84*91f16700Schasinglulu #define	LDBL_MIN_10_EXP	(-4931)
85*91f16700Schasinglulu #define	LDBL_MAX_EXP	(+16384)
86*91f16700Schasinglulu #define	LDBL_MAX	1.189731495357231765085759326628007016E+4932L
87*91f16700Schasinglulu #define	LDBL_MAX_10_EXP	(+4932)
88*91f16700Schasinglulu #if __ISO_C_VISIBLE >= 2011
89*91f16700Schasinglulu #define	LDBL_TRUE_MIN	6.475175119438025110924438958227646552E-4966L
90*91f16700Schasinglulu #define	LDBL_DECIMAL_DIG 36
91*91f16700Schasinglulu #define	LDBL_HAS_SUBNORM 1
92*91f16700Schasinglulu #endif /* __ISO_C_VISIBLE >= 2011 */
93*91f16700Schasinglulu 
94*91f16700Schasinglulu #endif /* _MACHINE_FLOAT_H_ */
95