xref: /dragonfly/include/float.h (revision c66c7e2f)
16ff43c94SPeter Avalos /*-
26ff43c94SPeter Avalos  * Copyright (c) 1989 Regents of the University of California.
36ff43c94SPeter Avalos  * All rights reserved.
46ff43c94SPeter Avalos  *
56ff43c94SPeter Avalos  * Redistribution and use in source and binary forms, with or without
66ff43c94SPeter Avalos  * modification, are permitted provided that the following conditions
76ff43c94SPeter Avalos  * are met:
86ff43c94SPeter Avalos  * 1. Redistributions of source code must retain the above copyright
96ff43c94SPeter Avalos  *    notice, this list of conditions and the following disclaimer.
106ff43c94SPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
116ff43c94SPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
126ff43c94SPeter Avalos  *    documentation and/or other materials provided with the distribution.
13*c66c7e2fSzrj  * 3. Neither the name of the University nor the names of its contributors
146ff43c94SPeter Avalos  *    may be used to endorse or promote products derived from this software
156ff43c94SPeter Avalos  *    without specific prior written permission.
166ff43c94SPeter Avalos  *
176ff43c94SPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
186ff43c94SPeter Avalos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
196ff43c94SPeter Avalos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
206ff43c94SPeter Avalos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
216ff43c94SPeter Avalos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
226ff43c94SPeter Avalos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
236ff43c94SPeter Avalos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
246ff43c94SPeter Avalos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
256ff43c94SPeter Avalos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
266ff43c94SPeter Avalos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
276ff43c94SPeter Avalos  * SUCH DAMAGE.
286ff43c94SPeter Avalos  *
296ff43c94SPeter Avalos  *	from: @(#)float.h	7.1 (Berkeley) 5/8/90
306ff43c94SPeter Avalos  * $FreeBSD: head/sys/x86/include/float.h 235939 2012-05-24 21:44:46Z obrien $
316ff43c94SPeter Avalos  */
326ff43c94SPeter Avalos 
336ff43c94SPeter Avalos #ifndef _FLOAT_H_
346ff43c94SPeter Avalos #define _FLOAT_H_
356ff43c94SPeter Avalos 
366ff43c94SPeter Avalos #include <sys/cdefs.h>
376ff43c94SPeter Avalos 
386ff43c94SPeter Avalos __BEGIN_DECLS
396ff43c94SPeter Avalos extern int __flt_rounds(void);
406ff43c94SPeter Avalos __END_DECLS
416ff43c94SPeter Avalos 
426ff43c94SPeter Avalos #define FLT_RADIX	2		/* b */
436ff43c94SPeter Avalos #define FLT_ROUNDS	__flt_rounds()
446ff43c94SPeter Avalos #if __ISO_C_VISIBLE >= 1999
456ff43c94SPeter Avalos #ifdef __LP64__
466ff43c94SPeter Avalos #define	FLT_EVAL_METHOD	0		/* no promotions */
476ff43c94SPeter Avalos #else
486ff43c94SPeter Avalos #define	FLT_EVAL_METHOD	(-1)		/* i387 semantics are...interesting */
496ff43c94SPeter Avalos #endif
506ff43c94SPeter Avalos #define	DECIMAL_DIG	21		/* max precision in decimal digits */
516ff43c94SPeter Avalos #endif
526ff43c94SPeter Avalos 
536ff43c94SPeter Avalos #define FLT_MANT_DIG	24		/* p */
546ff43c94SPeter Avalos #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */
556ff43c94SPeter Avalos #define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */
566ff43c94SPeter Avalos #define FLT_MIN_EXP	(-125)		/* emin */
576ff43c94SPeter Avalos #define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */
586ff43c94SPeter Avalos #define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */
596ff43c94SPeter Avalos #define FLT_MAX_EXP	128		/* emax */
606ff43c94SPeter Avalos #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */
616ff43c94SPeter Avalos #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */
626ff43c94SPeter Avalos #if __ISO_C_VISIBLE >= 2011
636ff43c94SPeter Avalos #define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */
646ff43c94SPeter Avalos #define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */
656ff43c94SPeter Avalos #define	FLT_HAS_SUBNORM	1
666ff43c94SPeter Avalos #endif /* __ISO_C_VISIBLE >= 2011 */
676ff43c94SPeter Avalos 
686ff43c94SPeter Avalos #define DBL_MANT_DIG	53
696ff43c94SPeter Avalos #define DBL_EPSILON	2.2204460492503131E-16
706ff43c94SPeter Avalos #define DBL_DIG		15
716ff43c94SPeter Avalos #define DBL_MIN_EXP	(-1021)
726ff43c94SPeter Avalos #define DBL_MIN		2.2250738585072014E-308
736ff43c94SPeter Avalos #define DBL_MIN_10_EXP	(-307)
746ff43c94SPeter Avalos #define DBL_MAX_EXP	1024
756ff43c94SPeter Avalos #define DBL_MAX		1.7976931348623157E+308
766ff43c94SPeter Avalos #define DBL_MAX_10_EXP	308
776ff43c94SPeter Avalos #if __ISO_C_VISIBLE >= 2011
786ff43c94SPeter Avalos #define	DBL_TRUE_MIN	4.9406564584124654E-324
796ff43c94SPeter Avalos #define	DBL_DECIMAL_DIG	17
806ff43c94SPeter Avalos #define	DBL_HAS_SUBNORM	1
816ff43c94SPeter Avalos #endif /* __ISO_C_VISIBLE >= 2011 */
826ff43c94SPeter Avalos 
836ff43c94SPeter Avalos #define LDBL_MANT_DIG	64
846ff43c94SPeter Avalos #define LDBL_EPSILON	1.0842021724855044340E-19L
856ff43c94SPeter Avalos #define LDBL_DIG	18
866ff43c94SPeter Avalos #define LDBL_MIN_EXP	(-16381)
876ff43c94SPeter Avalos #define LDBL_MIN	3.3621031431120935063E-4932L
886ff43c94SPeter Avalos #define LDBL_MIN_10_EXP	(-4931)
896ff43c94SPeter Avalos #define LDBL_MAX_EXP	16384
906ff43c94SPeter Avalos #define LDBL_MAX	1.1897314953572317650E+4932L
916ff43c94SPeter Avalos #define LDBL_MAX_10_EXP	4932
926ff43c94SPeter Avalos #if __ISO_C_VISIBLE >= 2011
936ff43c94SPeter Avalos #define	LDBL_TRUE_MIN	3.6451995318824746025E-4951L
946ff43c94SPeter Avalos #define	LDBL_DECIMAL_DIG 21
956ff43c94SPeter Avalos #define	LDBL_HAS_SUBNORM 1
966ff43c94SPeter Avalos #endif /* __ISO_C_VISIBLE >= 2011 */
976ff43c94SPeter Avalos 
986ff43c94SPeter Avalos #endif /* _FLOAT_H_ */
99