1 | /** @file
|
---|
2 | * IPRT / No-CRT - Our minimal float.h.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2022-2023 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef IPRT_INCLUDED_nocrt_float_h
|
---|
37 | #define IPRT_INCLUDED_nocrt_float_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <iprt/types.h>
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * Common.
|
---|
46 | */
|
---|
47 | #define FLT_RADIX 2
|
---|
48 |
|
---|
49 |
|
---|
50 | /*
|
---|
51 | * float
|
---|
52 | */
|
---|
53 | #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64)
|
---|
54 |
|
---|
55 | # define FLT_MAX (3.40282347E+38F)
|
---|
56 | # define FLT_MIN (1.17549435E-38F)
|
---|
57 | # define FLT_TRUE_MIN (1.40129846E-45F)
|
---|
58 | # define FLT_MAX_EXP (128)
|
---|
59 | # define FLT_MIN_EXP (-125)
|
---|
60 | # define FLT_MAX_10_EXP (38)
|
---|
61 | # define FLT_MIN_10_EXP (-37)
|
---|
62 | # define FLT_EPSILON (1.192092896E-07F)
|
---|
63 | # define FLT_DIG (6)
|
---|
64 | # define FLT_DECIMAL_DIG (9)
|
---|
65 | # define FLT_MANT_DIG (24)
|
---|
66 | # define FLT_HAS_SUBNORM (1)
|
---|
67 |
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * double
|
---|
72 | */
|
---|
73 | #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64)
|
---|
74 |
|
---|
75 | # ifdef _MSC_VER
|
---|
76 | # define DBL_MAX (1.7976931348623158E+308)
|
---|
77 | # else
|
---|
78 | # define DBL_MAX (1.7976931348623157E+308)
|
---|
79 | # endif
|
---|
80 | # define DBL_MIN (2.2250738585072014E-308)
|
---|
81 | # define DBL_TRUE_MIN (4.9406564584124654E-324)
|
---|
82 | # define DBL_MAX_EXP (1024)
|
---|
83 | # define DBL_MIN_EXP (-1021)
|
---|
84 | # define DBL_MAX_10_EXP (308)
|
---|
85 | # define DBL_MIN_10_EXP (-307)
|
---|
86 | # define DBL_EPSILON (2.2204460492503131E-16)
|
---|
87 | # define DBL_DIG (15)
|
---|
88 | # define DBL_DECIMAL_DIG (17)
|
---|
89 | # define DBL_MANT_DIG (53)
|
---|
90 | # define DBL_HAS_SUBNORM (1)
|
---|
91 |
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | /*
|
---|
95 | * long double
|
---|
96 | */
|
---|
97 | #if ((defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && defined(RT_OS_WINDOWS)) || defined(RT_ARCH_ARM64) /*?*/
|
---|
98 |
|
---|
99 | # define LDBL_MAX DBL_MAX
|
---|
100 | # define LDBL_MIN DBL_MIN
|
---|
101 | # define LDBL_TRUE_MIN DBL_TRUE_MIN
|
---|
102 | # define LDBL_MAX_EXP DBL_MAX_EXP
|
---|
103 | # define LDBL_MIN_EXP DBL_MIN_EXP
|
---|
104 | # define LDBL_MAX_10_EXP DBL_MAX_10_EXP
|
---|
105 | # define LDBL_MIN_10_EXP DBL_MIN_10_EXP
|
---|
106 | # define LDBL_EPSILON DBL_EPSILON
|
---|
107 | # define LDBL_DIG DBL_DIG
|
---|
108 | # define LDBL_DECIMAL_DIG DBL_DECIMAL_DIG
|
---|
109 | # define LDBL_MANT_DIG DBL_MANT_DIG
|
---|
110 | # define LDBL_HAS_SUBNORM DBL_HAS_SUBNORM
|
---|
111 |
|
---|
112 | #elif defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
|
---|
113 |
|
---|
114 | # define LDBL_MAX (1.1897314953572317650E+4932L)
|
---|
115 | # define LDBL_MIN (3.3621031431120935063E-4932L)
|
---|
116 | # define LDBL_TRUE_MIN (3.6451995318824746025E-4951L)
|
---|
117 | # define LDBL_MAX_EXP (-16381)
|
---|
118 | # define LDBL_MIN_EXP (16384)
|
---|
119 | # define LDBL_MAX_10_EXP (4932)
|
---|
120 | # define LDBL_MIN_10_EXP (-4931)
|
---|
121 | # define LDBL_EPSILON (1.0842021724855044340E-19L)
|
---|
122 | # define LDBL_DIG (18)
|
---|
123 | # define LDBL_DECIMAL_DIG (21)
|
---|
124 | # define LDBL_MANT_DIG (64)
|
---|
125 | # define LDBL_HAS_SUBNORM (1)
|
---|
126 |
|
---|
127 | #endif
|
---|
128 |
|
---|
129 |
|
---|
130 | #endif /* !IPRT_INCLUDED_nocrt_float_h */
|
---|
131 |
|
---|