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