xref: /openbsd/include/float.h (revision 5bf4abd5)
1 /*	$OpenBSD: float.h,v 1.1 2012/06/26 16:16:16 deraadt Exp $	*/
2 
3 /*
4  * Copyright (c) 1989 Regents of the University of California.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31 
32 #ifndef _FLOAT_H_
33 #define _FLOAT_H_
34 
35 #include <sys/cdefs.h>
36 #include <machine/_float.h>
37 
38 __BEGIN_DECLS
39 int __flt_rounds(void);
40 __END_DECLS
41 
42 #define FLT_RADIX	__FLT_RADIX		/* b */
43 #define FLT_ROUNDS	__FLT_ROUNDS
44 
45 #if __ISO_C_VISIBLE >= 1999
46 #define FLT_EVAL_METHOD	__FLT_EVAL_METHOD	/* long double */
47 #endif
48 
49 #define FLT_MANT_DIG	__FLT_MANT_DIG		/* p */
50 #define FLT_EPSILON	__FLT_EPSILON		/* b**(1-p) */
51 #ifndef FLT_DIG
52 #define FLT_DIG		__FLT_DIG		/* floor((p-1)*log10(b))+(b == 10) */
53 #endif
54 #define FLT_MIN_EXP	__FLT_MIN_EXP		/* emin */
55 #ifndef FLT_MIN
56 #define FLT_MIN		__FLT_MIN		/* b**(emin-1) */
57 #endif
58 #define FLT_MIN_10_EXP	__FLT_MIN_10_EXP	/* ceil(log10(b**(emin-1))) */
59 #define FLT_MAX_EXP	__FLT_MAX_EXP		/* emax */
60 #ifndef FLT_MAX
61 #define FLT_MAX		__FLT_MAX		/* (1-b**(-p))*b**emax */
62 #endif
63 #define FLT_MAX_10_EXP	__FLT_MAX_10_EXP	/* floor(log10((1-b**(-p))*b**emax)) */
64 
65 #define DBL_MANT_DIG	__DBL_MANT_DIG
66 #define DBL_EPSILON	__DBL_EPSILON
67 #ifndef DBL_DIG
68 #define DBL_DIG		__DBL_DIG
69 #endif
70 #define DBL_MIN_EXP	__DBL_MIN_EXP
71 #ifndef DBL_MIN
72 #define DBL_MIN		__DBL_MIN
73 #endif
74 #define DBL_MIN_10_EXP	__DBL_MIN_10_EXP
75 #define DBL_MAX_EXP	__DBL_MAX_EXP
76 #ifndef DBL_MAX
77 #define DBL_MAX		__DBL_MAX
78 #endif
79 #define DBL_MAX_10_EXP	__DBL_MAX_10_EXP
80 
81 #define LDBL_MANT_DIG	__LDBL_MANT_DIG
82 #define LDBL_EPSILON	__LDBL_EPSILON
83 #define LDBL_DIG	__LDBL_DIG
84 #define LDBL_MIN_EXP	__LDBL_MIN_EXP
85 #define LDBL_MIN	__LDBL_MIN
86 #define LDBL_MIN_10_EXP	__LDBL_MIN_10_EXP
87 #define LDBL_MAX_EXP	__LDBL_MAX_EXP
88 #define LDBL_MAX	__LDBL_MAX
89 #define LDBL_MAX_10_EXP	__LDBL_MAX_10_EXP
90 
91 #if __ISO_C_VISIBLE >= 1999
92 #define DECIMAL_DIG	__DECIMAL_DIG
93 #endif
94 
95 #endif	/* _FLOAT_H_ */
96