1 #ifndef _PDCLIB_PDCLIB_FLOAT_H
\r
2 #define _PDCLIB_PDCLIB_FLOAT_H _PDCLIB_PDCLIB_FLOAT_H
\r
4 /* PDCLib internal floating point logic <_PDCLIB_float.h>
\r
6 This file is part of the Public Domain C Library (PDCLib).
\r
7 Permission is granted to use, modify, and / or redistribute at will.
\r
10 /* IEEE 754 single precision */
\r
11 #define _PDCLIB_FP_SINGLE_MIN 1.17549435082228750797e-38
\r
12 #define _PDCLIB_FP_SINGLE_EPSILON 1.19209289550781250000e-7
\r
13 #define _PDCLIB_FP_SINGLE_HAS_DENORM 1
\r
14 #define _PDCLIB_FP_SINGLE_MIN_EXP -125
\r
15 #define _PDCLIB_FP_SINGLE_MANT_DIG 24
\r
16 #define _PDCLIB_FP_SINGLE_RADIX 2
\r
17 #define _PDCLIB_FP_SINGLE_HAS_QUIET_NAN 1
\r
18 #define _PDCLIB_FP_SINGLE_MAX_10_EXP 38
\r
19 #define _PDCLIB_FP_SINGLE_HAS_INFINITY 1
\r
20 #define _PDCLIB_FP_SINGLE_DIG 6
\r
21 #define _PDCLIB_FP_SINGLE_MAX_EXP 128
\r
22 #define _PDCLIB_FP_SINGLE_DENORM_MIN 1.40129846432481707092e-45
\r
23 #define _PDCLIB_FP_SINGLE_MAX 3.40282346638528859812e+38
\r
24 #define _PDCLIB_FP_SINGLE_MIN_10_EXP -37
\r
26 /* IEEE 754 double precision */
\r
27 #define _PDCLIB_FP_DOUBLE_MIN_EXP -1021
\r
28 #define _PDCLIB_FP_DOUBLE_DENORM_MIN 4.94065645841246544177e-324
\r
29 #define _PDCLIB_FP_DOUBLE_MIN_10_EXP -307
\r
30 #define _PDCLIB_FP_DOUBLE_DIG 15
\r
31 #define _PDCLIB_FP_DOUBLE_MAX 1.79769313486231570815e+308
\r
32 #define _PDCLIB_FP_DOUBLE_HAS_INFINITY 1
\r
33 #define _PDCLIB_FP_DOUBLE_MAX_EXP 1024
\r
34 #define _PDCLIB_FP_DOUBLE_MIN 2.22507385850720138309e-308
\r
35 #define _PDCLIB_FP_DOUBLE_HAS_DENORM 1
\r
36 #define _PDCLIB_FP_DOUBLE_HAS_QUIET_NAN 1
\r
37 #define _PDCLIB_FP_DOUBLE_MANT_DIG 53
\r
38 #define _PDCLIB_FP_DOUBLE_EPSILON 2.22044604925031308085e-16
\r
39 #define _PDCLIB_FP_DOUBLE_MAX_10_EXP 308
\r
41 /* IEEE 754 80-bit extended precision */
\r
42 #define _PDCLIB_FP_EXTENDED_MAX 1.18973149535723176502e+4932
\r
43 #define _PDCLIB_FP_EXTENDED_MAX_EXP 16384
\r
44 #define _PDCLIB_FP_EXTENDED_HAS_INFINITY 1
\r
45 #define _PDCLIB_FP_EXTENDED_MIN 3.36210314311209350626e-4932
\r
46 #define _PDCLIB_FP_EXTENDED_HAS_QUIET_NAN 1
\r
47 #define _PDCLIB_FP_EXTENDED_HAS_DENORM 1
\r
48 #define _PDCLIB_FP_EXTENDED_EPSILON 1.08420217248550443401e-19
\r
49 #define _PDCLIB_FP_EXTENDED_MANT_DIG 64
\r
50 #define _PDCLIB_FP_EXTENDED_MIN_EXP (-16381)
\r
51 #define _PDCLIB_FP_EXTENDED_MAX_10_EXP 4932
\r
52 #define _PDCLIB_FP_EXTENDED_DENORM_MIN 3.64519953188247460253e-4951
\r
53 #define _PDCLIB_FP_EXTENDED_MIN_10_EXP (-4931)
\r
54 #define _PDCLIB_FP_EXTENDED_DIG 18
\r
56 /* TODO: IEEE754 quadruple precision (_PDCLIB_FP_QUADRUPLE_*) and
\r
57 "double-double" math
\r
60 #define _PDCLIB_FLT_RADIX ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _RADIX ))
\r
61 #define _PDCLIB_FLT_MANT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MANT_DIG )
\r
62 #define _PDCLIB_FLT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _DIG )
\r
63 #define _PDCLIB_FLT_EPSILON ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _EPSILON ))
\r
64 #define _PDCLIB_FLT_MIN_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MIN_EXP )
\r
65 #define _PDCLIB_FLT_MIN ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MIN ))
\r
66 #define _PDCLIB_FLT_MIN_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MIN_10_EXP )
\r
67 #define _PDCLIB_FLT_MAX_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MAX_EXP )
\r
68 #define _PDCLIB_FLT_MAX ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MAX ))
\r
69 #define _PDCLIB_FLT_MAX_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MAX_10_EXP )
\r
71 #define _PDCLIB_DBL_RADIX ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _RADIX ))
\r
72 #define _PDCLIB_DBL_MANT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MANT_DIG )
\r
73 #define _PDCLIB_DBL_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _DIG )
\r
74 #define _PDCLIB_DBL_EPSILON ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _EPSILON ))
\r
75 #define _PDCLIB_DBL_MIN_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MIN_EXP )
\r
76 #define _PDCLIB_DBL_MIN ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MIN ))
\r
77 #define _PDCLIB_DBL_MIN_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MIN_10_EXP )
\r
78 #define _PDCLIB_DBL_MAX_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MAX_EXP )
\r
79 #define _PDCLIB_DBL_MAX ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MAX ))
\r
80 #define _PDCLIB_DBL_MAX_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MAX_10_EXP )
\r
82 #define _PDCLIB_LDBL_RADIX ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _RADIX ))
\r
83 #define _PDCLIB_LDBL_MANT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MANT_DIG )
\r
84 #define _PDCLIB_LDBL_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _DIG )
\r
85 #define _PDCLIB_LDBL_EPSILON ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _EPSILON ))
\r
86 #define _PDCLIB_LDBL_MIN_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MIN_EXP )
\r
87 #define _PDCLIB_LDBL_MIN ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MIN ))
\r
88 #define _PDCLIB_LDBL_MIN_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MIN_10_EXP )
\r
89 #define _PDCLIB_LDBL_MAX_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MAX_EXP )
\r
90 #define _PDCLIB_LDBL_MAX ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MAX ))
\r
91 #define _PDCLIB_LDBL_MAX_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MAX_10_EXP )
\r