xref: /freebsd/sys/amd64/include/float.h (revision 46280ae71938465be665fb19cf8f7d1ca48a379a)
146280ae7SWarner Losh /*-
25b81b6b3SRodney W. Grimes  * Copyright (c) 1989 Regents of the University of California.
35b81b6b3SRodney W. Grimes  * All rights reserved.
45b81b6b3SRodney W. Grimes  *
55b81b6b3SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
65b81b6b3SRodney W. Grimes  * modification, are permitted provided that the following conditions
75b81b6b3SRodney W. Grimes  * are met:
85b81b6b3SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
95b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
105b81b6b3SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
115b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
125b81b6b3SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
135b81b6b3SRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
145b81b6b3SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
155b81b6b3SRodney W. Grimes  *    without specific prior written permission.
165b81b6b3SRodney W. Grimes  *
175b81b6b3SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
185b81b6b3SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
195b81b6b3SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
205b81b6b3SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
215b81b6b3SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
225b81b6b3SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
235b81b6b3SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
245b81b6b3SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
255b81b6b3SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
265b81b6b3SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
275b81b6b3SRodney W. Grimes  * SUCH DAMAGE.
285b81b6b3SRodney W. Grimes  *
2934a8ed1bSRodney W. Grimes  *	from: @(#)float.h	7.1 (Berkeley) 5/8/90
30c3aac50fSPeter Wemm  * $FreeBSD$
315b81b6b3SRodney W. Grimes  */
325b81b6b3SRodney W. Grimes 
336e393973SGarrett Wollman #ifndef _MACHINE_FLOAT_H_
346e393973SGarrett Wollman #define _MACHINE_FLOAT_H_ 1
356e393973SGarrett Wollman 
36be393068SDavid Schultz #include <sys/cdefs.h>
37be393068SDavid Schultz 
38479f8d22SDavid Schultz __BEGIN_DECLS
39479f8d22SDavid Schultz extern int __flt_rounds(void);
40479f8d22SDavid Schultz __END_DECLS
41479f8d22SDavid Schultz 
425b81b6b3SRodney W. Grimes #define FLT_RADIX	2		/* b */
43479f8d22SDavid Schultz #define FLT_ROUNDS	__flt_rounds()
44be393068SDavid Schultz #if __ISO_C_VISIBLE >= 1999
458cf5ed51SMike Barcroft #define	FLT_EVAL_METHOD	(-1)		/* i387 semantics are...interesting */
468cf5ed51SMike Barcroft #define	DECIMAL_DIG	21		/* max precision in decimal digits */
47be393068SDavid Schultz #endif
485b81b6b3SRodney W. Grimes 
495b81b6b3SRodney W. Grimes #define FLT_MANT_DIG	24		/* p */
505b81b6b3SRodney W. Grimes #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */
515b81b6b3SRodney W. Grimes #define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */
52beb7ebb0SNate Williams #define FLT_MIN_EXP	(-125)		/* emin */
535b81b6b3SRodney W. Grimes #define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */
54beb7ebb0SNate Williams #define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */
555b81b6b3SRodney W. Grimes #define FLT_MAX_EXP	128		/* emax */
565b81b6b3SRodney W. Grimes #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */
575b81b6b3SRodney W. Grimes #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */
585b81b6b3SRodney W. Grimes 
595b81b6b3SRodney W. Grimes #define DBL_MANT_DIG	53
605b81b6b3SRodney W. Grimes #define DBL_EPSILON	2.2204460492503131E-16
615b81b6b3SRodney W. Grimes #define DBL_DIG		15
62beb7ebb0SNate Williams #define DBL_MIN_EXP	(-1021)
63330b1513SNate Williams #define DBL_MIN		2.2250738585072014E-308
64beb7ebb0SNate Williams #define DBL_MIN_10_EXP	(-307)
655b81b6b3SRodney W. Grimes #define DBL_MAX_EXP	1024
66330b1513SNate Williams #define DBL_MAX		1.7976931348623157E+308
675b81b6b3SRodney W. Grimes #define DBL_MAX_10_EXP	308
685b81b6b3SRodney W. Grimes 
69d7937918SWarner Losh #define LDBL_MANT_DIG	64
70d7937918SWarner Losh #define LDBL_EPSILON	1.0842021724855044340E-19L
71d7937918SWarner Losh #define LDBL_DIG	18
72d7937918SWarner Losh #define LDBL_MIN_EXP	(-16381)
73d7937918SWarner Losh #define LDBL_MIN	3.3621031431120935063E-4932L
74d7937918SWarner Losh #define LDBL_MIN_10_EXP	(-4931)
75d7937918SWarner Losh #define LDBL_MAX_EXP	16384
76d7937918SWarner Losh #define LDBL_MAX	1.1897314953572317650E+4932L
77d7937918SWarner Losh #define LDBL_MAX_10_EXP	4932
786e393973SGarrett Wollman #endif /* _MACHINE_FLOAT_H_ */
79