-
Notifications
You must be signed in to change notification settings - Fork 1
/
declimits
175 lines (156 loc) · 8.38 KB
/
declimits
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* ------------------------------------------------------------------ */
/* declimits header */
/* ------------------------------------------------------------------ */
/* Copyright (c) IBM Corporation, 2006. All rights reserved. */
/* */
/* This software is made available under the terms of the IBM */
/* alphaWorks License Agreement (distributed with this software as */
/* alphaWorks-License.txt). Your use of this software indicates */
/* your acceptance of the terms and conditions of that Agreement. */
/* */
/* Please send comments, suggestions, and corrections to the author: */
/* klarer@ca.ibm.com */
/* Robert Klarer */
/* ------------------------------------------------------------------ */
#ifndef _DECLIMITS_
#define _DECLIMITS_
#include <limits>
#include "cdecfloat"
namespace std {
template<>
class numeric_limits<decimal::decimal32>
: public _Num_float_base {
public:
static const bool is_specialized = true;
static decimal::decimal32 min() throw()
{ return DEC32_MIN; }
static decimal::decimal32 max() throw()
{ return DEC32_MAX; }
static const int digits = DEC32_MANT_DIG;
static const int digits10 = digits;
static const int max_digits10 = digits;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 10;
static decimal::decimal32 epsilon() throw()
{ return DEC32_EPSILON; }
static decimal::decimal32 round_error() throw()
{ return decimal::decimal32(5ULL, -1); }
static const int min_exponent = DEC32_MIN_EXP;
static const int min_exponent10 = min_exponent;
static const int max_exponent = DEC32_MAX_EXP;
static const int max_exponent10 = max_exponent;
static const bool has_infinity = true;
static const bool has_quiet_NaN = true;
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_present;
static const bool has_denorm_loss = true;
static decimal::decimal32 infinity() throw()
{ return decimal::decimal32::_GetINF(); }
static decimal::decimal32 quiet_NaN() throw()
{ return decimal::decimal32::_GetNAN(); }
static decimal::decimal32 signaling_NaN() throw()
{ return decimal::decimal32::_GetSNAN(); }
static decimal::decimal32 denorm_min() throw()
{ return decimal::decimal32::_GetDenormalizedMin(); }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = true;
static const bool tinyness_before = true;
static const float_round_style round_style
= round_indeterminate;
};
template<>
class numeric_limits<decimal::decimal64>
: public _Num_float_base {
public:
static const bool is_specialized = true;
static decimal::decimal64 min() throw()
{ return DEC64_MIN; }
static decimal::decimal64 max() throw()
{ return DEC64_MAX; }
static const int digits = DEC64_MANT_DIG;
static const int digits10 = digits;
static const int max_digits10 = digits;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 10;
static decimal::decimal64 epsilon() throw()
{ return DEC64_EPSILON; }
static decimal::decimal64 round_error() throw()
{ return decimal::decimal64(5ULL, -1); }
static const int min_exponent = DEC64_MIN_EXP;
static const int min_exponent10 = min_exponent;
static const int max_exponent = DEC64_MAX_EXP;
static const int max_exponent10 = max_exponent;
static const bool has_infinity = true;
static const bool has_quiet_NaN = true;
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_present;
static const bool has_denorm_loss = true;
static decimal::decimal64 infinity() throw()
{ return decimal::decimal64::_GetINF(); }
static decimal::decimal64 quiet_NaN() throw()
{ return decimal::decimal64::_GetNAN(); }
static decimal::decimal64 signaling_NaN() throw()
{ return decimal::decimal64::_GetSNAN(); }
static decimal::decimal64 denorm_min() throw()
{ return DEC64_DEN; }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = true;
static const bool tinyness_before = true;
static const float_round_style round_style
= round_indeterminate;
};
template<>
class numeric_limits<decimal::decimal128>
: public _Num_float_base {
public:
static const bool is_specialized = true;
static decimal::decimal128 min() throw()
{ return DEC128_MIN; }
static decimal::decimal128 max() throw()
{ return DEC128_MAX; }
static const int digits = DEC128_MANT_DIG;
static const int digits10 = digits;
static const int max_digits10 = digits;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 10;
static decimal::decimal128 epsilon() throw()
{ return DEC128_EPSILON; }
static decimal::decimal128 round_error() throw()
{ return decimal::decimal128(5ULL, -1); }
static const int min_exponent = DEC128_MIN_EXP;
static const int min_exponent10 = min_exponent;
static const int max_exponent = DEC128_MAX_EXP;
static const int max_exponent10 = max_exponent;
static const bool has_infinity = true;
static const bool has_quiet_NaN = true;
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_present;
static const bool has_denorm_loss = true;
static decimal::decimal128 infinity() throw()
{ return decimal::decimal128::_GetINF(); }
static decimal::decimal128 quiet_NaN() throw()
{ return decimal::decimal128::_GetNAN(); }
static decimal::decimal128 signaling_NaN() throw()
{ return decimal::decimal128::_GetSNAN(); }
static decimal::decimal128 denorm_min() throw()
{ return DEC128_DEN; }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = true;
static const bool tinyness_before = true;
static const float_round_style round_style
= round_indeterminate;
};
}
#endif /* ndef _DECLIMITS_ */