1139825Simp/*-
296692Sobrien * Copyright (c) 1989 Regents of the University of California.
396692Sobrien * All rights reserved.
496692Sobrien *
596692Sobrien * Redistribution and use in source and binary forms, with or without
696692Sobrien * modification, are permitted provided that the following conditions
796692Sobrien * are met:
896692Sobrien * 1. Redistributions of source code must retain the above copyright
996692Sobrien *    notice, this list of conditions and the following disclaimer.
1096692Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1196692Sobrien *    notice, this list of conditions and the following disclaimer in the
1296692Sobrien *    documentation and/or other materials provided with the distribution.
1396692Sobrien * 4. Neither the name of the University nor the names of its contributors
1496692Sobrien *    may be used to endorse or promote products derived from this software
1596692Sobrien *    without specific prior written permission.
1696692Sobrien *
1796692Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1896692Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1996692Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2096692Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2196692Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2296692Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2396692Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2496692Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2596692Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2696692Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2796692Sobrien * SUCH DAMAGE.
2896692Sobrien *
2996692Sobrien *	from: @(#)float.h	7.1 (Berkeley) 5/8/90
3096692Sobrien *	from: FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11
3196692Sobrien * $FreeBSD: releng/10.3/sys/powerpc/include/float.h 230475 2012-01-23 06:36:41Z das $
3296692Sobrien */
3396692Sobrien
3496692Sobrien#ifndef _MACHINE_FLOAT_H_
3596692Sobrien#define _MACHINE_FLOAT_H_ 1
3696692Sobrien
37128629Sdas#include <sys/cdefs.h>
38128629Sdas
39176530Sraj#ifndef _SOFT_FLOAT
40132383Sdas__BEGIN_DECLS
41132383Sdasextern int __flt_rounds(void);
42132383Sdas__END_DECLS
43176530Sraj#define FLT_ROUNDS	__flt_rounds()
44176530Sraj#else
45230366Sdas#define FLT_ROUNDS	(-1)
46176530Sraj#endif
47132383Sdas
4896692Sobrien#define FLT_RADIX	2		/* b */
49128629Sdas#if __ISO_C_VISIBLE >= 1999
50230228Sdas#define	FLT_EVAL_METHOD	0
51217181Sdas#define	DECIMAL_DIG	17		/* max precision in decimal digits */
52128629Sdas#endif
5396692Sobrien
5496692Sobrien#define FLT_MANT_DIG	24		/* p */
5596692Sobrien#define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */
5696692Sobrien#define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */
5796692Sobrien#define FLT_MIN_EXP	(-125)		/* emin */
5896692Sobrien#define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */
5996692Sobrien#define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */
6096692Sobrien#define FLT_MAX_EXP	128		/* emax */
6196692Sobrien#define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */
6296692Sobrien#define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */
63230475Sdas#if __ISO_C_VISIBLE >= 2011
64230475Sdas#define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */
65230475Sdas#define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */
66230475Sdas#define	FLT_HAS_SUBNORM	1
67230475Sdas#endif /* __ISO_C_VISIBLE >= 2011 */
6896692Sobrien
6996692Sobrien#define DBL_MANT_DIG	53
7096692Sobrien#define DBL_EPSILON	2.2204460492503131E-16
7196692Sobrien#define DBL_DIG		15
7296692Sobrien#define DBL_MIN_EXP	(-1021)
7396692Sobrien#define DBL_MIN		2.2250738585072014E-308
7496692Sobrien#define DBL_MIN_10_EXP	(-307)
7596692Sobrien#define DBL_MAX_EXP	1024
7696692Sobrien#define DBL_MAX		1.7976931348623157E+308
7796692Sobrien#define DBL_MAX_10_EXP	308
78230475Sdas#if __ISO_C_VISIBLE >= 2011
79230475Sdas#define	DBL_TRUE_MIN	4.9406564584124654E-324
80230475Sdas#define	DBL_DECIMAL_DIG	17
81230475Sdas#define	DBL_HAS_SUBNORM	1
82230475Sdas#endif /* __ISO_C_VISIBLE >= 2011 */
8396692Sobrien
84132421Sgallatin#define LDBL_MANT_DIG	DBL_MANT_DIG
85230366Sdas#define LDBL_EPSILON	((long double)DBL_EPSILON)
86132421Sgallatin#define LDBL_DIG	DBL_DIG
87132421Sgallatin#define LDBL_MIN_EXP	DBL_MIN_EXP
88230366Sdas#define LDBL_MIN	((long double)DBL_MIN)
89132421Sgallatin#define LDBL_MIN_10_EXP	DBL_MIN_10_EXP
90132421Sgallatin#define LDBL_MAX_EXP	DBL_MAX_EXP
91230366Sdas#define LDBL_MAX	((long double)DBL_MAX)
92132421Sgallatin#define LDBL_MAX_10_EXP	DBL_MAX_10_EXP
93230475Sdas#if __ISO_C_VISIBLE >= 2011
94230475Sdas#define	LDBL_TRUE_MIN	((long double)DBL_TRUE_MIN)
95230475Sdas#define	LDBL_DECIMAL_DIG DBL_DECIMAL_DIG
96230475Sdas#define	LDBL_HAS_SUBNORM DBL_HAS_SUBNORM
97230475Sdas#endif /* __ISO_C_VISIBLE >= 2011 */
98124768Sgrehan
9996692Sobrien#endif /* _MACHINE_FLOAT_H_ */
100