Skip to content

Commit c090cbb

Browse files
authored
Merge pull request #930 from cppalliance/587
Rename types and add deprecation warnings to the old ones
2 parents f2307f9 + 6f8ecf9 commit c090cbb

File tree

251 files changed

+9508
-9430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+9508
-9430
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ Decimal provides 3 IEEE-754 compliant types:
6767
namespace boost {
6868
namespace decimal {
6969

70-
class decimal32;
71-
class decimal64;
72-
class decimal128;
70+
class decimal32_t;
71+
class decimal64_t;
72+
class decimal128_t;
7373

7474
} //namespace decimal
7575
} //namespace boost
@@ -81,9 +81,9 @@ and also 3 similar but non-compliant types with improved runtime performance:
8181
namespace boost {
8282
namespace decimal {
8383
84-
class decimal32_fast;
85-
class decimal64_fast;
86-
class decimal128_fast;
84+
class decimal_fast32_t;
85+
class decimal_fast64_t;
86+
class decimal_fast128_t;
8787
8888
} //namespace decimal
8989
} //namespace boost
@@ -103,10 +103,10 @@ Using the decimal types is simple.
103103

104104
int main()
105105
{
106-
using boost::decimal::decimal32;
106+
using boost::decimal::decimal32_t;
107107

108-
constexpr decimal32 a {2, -1}; // Constructs the number 0.2
109-
constexpr decimal32 b {1, -1}; // Constructs the number 0.1
108+
constexpr decimal32_t a {2, -1}; // Constructs the number 0.2
109+
constexpr decimal32_t b {1, -1}; // Constructs the number 0.1
110110
auto sum {a + b};
111111

112112
std::cout << sum << std::endl; // prints 0.3
@@ -133,15 +133,15 @@ int main()
133133
{
134134
using namespace boost::decimal;
135135

136-
decimal64 val {-0.25}; // Construction from a double
136+
decimal64_t val {-0.25}; // Construction from a double
137137
val = abs(val); // DO NOT call std::abs
138138

139139
char buffer[256];
140140
auto r_to = to_chars(buffer, buffer + sizeof(buffer) - 1, val);
141141
assert(r_to); // checks std::errc()
142142
*r_to.ptr = '\0';
143143

144-
decimal64 return_value;
144+
decimal64_t return_value;
145145
auto r_from = from_chars(buffer, buffer + std::strlen(buffer), return_value);
146146

147147
assert(val == return_value);

doc/modules/ROOT/nav.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* xref:examples.adoc[]
44
* xref:api_reference.adoc[]
55
* xref:generic_decimal.adoc[]
6-
** xref:decimal32.adoc[]
7-
** xref:decimal64.adoc[]
8-
** xref:decimal128.adoc[]
6+
** xref:decimal32_t.adoc[]
7+
** xref:decimal64_t.adoc[]
8+
** xref:decimal128_t.adoc[]
99
* xref:fast_types.adoc[]
10-
** xref:decimal32_fast.adoc[]
11-
** xref:decimal64_fast.adoc[]
12-
** xref:decimal128_fast.adoc[]
10+
** xref:decimal_fast32_t.adoc[]
11+
** xref:decimal_fast64_t.adoc[]
12+
** xref:decimal_fast128_t.adoc[]
1313
* xref:conversions.adoc[]
1414
* xref:literals.adoc[]
1515
* xref:numbers.adoc[]

doc/modules/ROOT/pages/api_reference.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ enums, constants and macros that are provided in this library.
1515

1616
=== IEEE 754 Compliant Types
1717

18-
- xref:decimal32.adoc[decimal32]
19-
- xref:decimal64.adoc[decimal64]
20-
- xref:decimal128.adoc[decima128]
18+
- xref:decimal32_t.adoc[decimal32_t]
19+
- xref:decimal64_t.adoc[decimal64_t]
20+
- xref:decimal128_t.adoc[decima128]
2121

2222
=== Non-IEEE 754 Compliant Types
2323

24-
- xref:decimal32_fast.adoc[decimal32_fast]
25-
- xref:decimal64_fast.adoc[decimal64_fast]
26-
- xref:decimal128_fast.adoc[decimal128_fast]
24+
- xref:decimal_fast32_t.adoc[decimal_fast32_t]
25+
- xref:decimal_fast64_t.adoc[decimal_fast64_t]
26+
- xref:decimal_fast128_t.adoc[decimal_fast128_t]
2727

2828
== Structures
2929

doc/modules/ROOT/pages/basics.adoc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ Every decimal type can be constructed in a few ways:
1717
[source, c++]
1818
----
1919
template <typename UnsignedInteger, typename Integer>
20-
constexpr decimal32(UnsignedInteger coefficient, Integer exponent, bool sign = false) noexcept;
20+
constexpr decimal32_t(UnsignedInteger coefficient, Integer exponent, bool sign = false) noexcept;
2121
2222
template <typename SignedInteger, typename Integer>
23-
constexpr decimal32(SignedInteger coefficient, Integer exponent) noexcept;
23+
constexpr decimal32_t(SignedInteger coefficient, Integer exponent) noexcept;
2424
----
2525

2626
As you can see you are either allowed to pass a signed integer, or specify the signedness of the resulting number, but not both.
2727
This is designed to reduce confusion (e.g. what would be the resulting sign of `{-3, 0, true}`?)
2828

2929
[souce, c++]
3030
----
31-
boost::decimal::decimal32 a {1, 1}; // constructs 1e1 = 10
32-
boost::decimal::decimal32 b {-2, -1}; // constructs -2e-2 or -0.2
33-
boost::decimal::decimal32 c {2, -1, true}; // also constructs -2e-1 or -0.2
34-
boost::decimal::decimal32 e {5, 5}; // constructs 5x10^5
35-
boost::decimal::decimal32 f {1234, -3} // constructs 1.234 or 1234x10^-3
31+
boost::decimal::decimal32_t a {1, 1}; // constructs 1e1 = 10
32+
boost::decimal::decimal32_t b {-2, -1}; // constructs -2e-2 or -0.2
33+
boost::decimal::decimal32_t c {2, -1, true}; // also constructs -2e-1 or -0.2
34+
boost::decimal::decimal32_t e {5, 5}; // constructs 5x10^5
35+
boost::decimal::decimal32_t f {1234, -3} // constructs 1.234 or 1234x10^-3
3636
----
3737

3838
=== Construction from Integer
@@ -42,8 +42,8 @@ For example:
4242

4343
[source, c++]
4444
----
45-
boost::decimal::decimal64 g = 1;
46-
boost::decimal::decimal32 h {-4};
45+
boost::decimal::decimal64_t g = 1;
46+
boost::decimal::decimal32_t h {-4};
4747
----
4848

4949
=== Construction from Binary Floating Point
@@ -53,7 +53,7 @@ For example:
5353

5454
[source, c++]
5555
----
56-
boost::decimal::decimal128 pi {3.14};
56+
boost::decimal::decimal128_t pi {3.14};
5757
----
5858

5959
NOTE: Due to the differences in decimal and binary floating point numbers there may be a difference in the resulting representation in decimal format, and thus it is not recommended to construct from binary floating point numbers
@@ -77,8 +77,8 @@ int main()
7777
std::cout << std::setprecision(17) << 0.1 + 0.2 << std::endl;
7878
7979
// Construct the two decimal values
80-
constexpr decimal64 a {1, -1}; // 1e-1 or 0.1
81-
constexpr decimal64 b {2, -1}; // 2e-1 or 0.2
80+
constexpr decimal64_t a {1, -1}; // 1e-1 or 0.1
81+
constexpr decimal64_t b {2, -1}; // 2e-1 or 0.2
8282
8383
// Outputs 0.30000000000000000
8484
std::cout << a + b << std::endl;

0 commit comments

Comments
 (0)