Skip to content

Commit 6d088b3

Browse files
authored
Merge pull request #661 from cppalliance/develop
2 parents 67793ad + 80060d2 commit 6d088b3

File tree

110 files changed

+14301
-1328
lines changed

Some content is hidden

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

110 files changed

+14301
-1328
lines changed

.drone.jsonnet

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,44 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
159159
),
160160

161161
linux_pipeline(
162-
"Linux 22.04 GCC 12 32 ASAN",
162+
"Linux 22.04 GCC 12 32 ASAN 03",
163163
"cppalliance/droneubuntu2204:1",
164-
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
164+
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03', ADDRMD: '32' } + asan,
165+
"g++-12-multilib",
166+
),
167+
168+
linux_pipeline(
169+
"Linux 22.04 GCC 12 32 ASAN 11",
170+
"cppalliance/droneubuntu2204:1",
171+
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '11', ADDRMD: '32' } + asan,
172+
"g++-12-multilib",
173+
),
174+
175+
linux_pipeline(
176+
"Linux 22.04 GCC 12 32 ASAN 14",
177+
"cppalliance/droneubuntu2204:1",
178+
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '14', ADDRMD: '32' } + asan,
179+
"g++-12-multilib",
180+
),
181+
182+
linux_pipeline(
183+
"Linux 22.04 GCC 12 32 ASAN 17",
184+
"cppalliance/droneubuntu2204:1",
185+
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '17', ADDRMD: '32' } + asan,
186+
"g++-12-multilib",
187+
),
188+
189+
linux_pipeline(
190+
"Linux 22.04 GCC 12 32 ASAN 20",
191+
"cppalliance/droneubuntu2204:1",
192+
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '20', ADDRMD: '32' } + asan,
193+
"g++-12-multilib",
194+
),
195+
196+
linux_pipeline(
197+
"Linux 22.04 GCC 12 32 ASAN 2b",
198+
"cppalliance/droneubuntu2204:1",
199+
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '2b', ADDRMD: '32' } + asan,
165200
"g++-12-multilib",
166201
),
167202

@@ -187,16 +222,30 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
187222
),
188223

189224
linux_pipeline(
190-
"Linux 24.04 GCC 14 32/64",
225+
"Linux 24.04 GCC 14 32",
226+
"cppalliance/droneubuntu2404:1",
227+
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32', CXXFLAGS: "-fexcess-precision=fast" },
228+
"g++-14-multilib",
229+
),
230+
231+
linux_pipeline(
232+
"Linux 24.04 GCC 14 64",
233+
"cppalliance/droneubuntu2404:1",
234+
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '64', CXXFLAGS: "-fexcess-precision=fast" },
235+
"g++-14-multilib",
236+
),
237+
238+
linux_pipeline(
239+
"Linux 24.04 GCC 14 GNU 32",
191240
"cppalliance/droneubuntu2404:1",
192-
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32,64', CXXFLAGS: "-fexcess-precision=fast" },
241+
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32', CXXFLAGS: "-fexcess-precision=fast", CXXSTDDIALECT: "gnu" },
193242
"g++-14-multilib",
194243
),
195244

196245
linux_pipeline(
197-
"Linux 24.04 GCC 14 GNU 32/64",
246+
"Linux 24.04 GCC 14 GNU 64",
198247
"cppalliance/droneubuntu2404:1",
199-
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32,64', CXXFLAGS: "-fexcess-precision=fast", CXXSTDDIALECT: "gnu" },
248+
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '64', CXXFLAGS: "-fexcess-precision=fast", CXXSTDDIALECT: "gnu" },
200249
"g++-14-multilib",
201250
),
202251

@@ -358,16 +407,6 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
358407
["deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"],
359408
),
360409

361-
macos_pipeline(
362-
"MacOS 10.15 Xcode 12.2 UBSAN",
363-
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,2a' } + ubsan,
364-
),
365-
366-
macos_pipeline(
367-
"MacOS 10.15 Xcode 12.2 ASAN",
368-
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,2a' } + asan,
369-
),
370-
371410
macos_pipeline(
372411
"MacOS 12.4 Xcode 13.4.1 UBSAN",
373412
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + ubsan,

.github/workflows/ci.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ jobs:
248248
cxxstd: "03,11,14,17,20,2b"
249249
os: macos-14
250250

251-
timeout-minutes: 120
251+
timeout-minutes: 180
252252
runs-on: ${{matrix.os}}
253253
container: ${{matrix.container}}
254254

@@ -456,20 +456,30 @@ jobs:
456456
include:
457457
- toolset: msvc-14.2
458458
cxxstd: "14,17,20,latest"
459-
addrmd: 32,64
459+
addrmd: "32"
460460
os: windows-2019
461-
- toolset: msvc-14.3
461+
# B2 does not work with MSVC 17.10. Once it's updated we can re-enable these tests
462+
# Still covered in drone
463+
#- toolset: msvc-14.3
464+
# cxxstd: "14,17,20,latest"
465+
# addrmd: "32"
466+
# os: windows-2022
467+
- toolset: msvc-14.2
462468
cxxstd: "14,17,20,latest"
463-
addrmd: 32,64
464-
os: windows-2022
465-
- toolset: clang-win
466-
cxxstd: "14,17,latest"
467-
addrmd: "32"
468-
os: windows-2022
469-
- toolset: clang-win
470-
cxxstd: "14,17,latest"
471469
addrmd: "64"
472-
os: windows-2022
470+
os: windows-2019
471+
#- toolset: msvc-14.3
472+
# cxxstd: "14,17,20,latest"
473+
# addrmd: "64"
474+
# os: windows-2022
475+
#- toolset: clang-win
476+
# cxxstd: "14,17,latest"
477+
# addrmd: "32"
478+
# os: windows-2022
479+
#- toolset: clang-win
480+
# cxxstd: "14,17,latest"
481+
# addrmd: "64"
482+
# os: windows-2022
473483
- toolset: gcc
474484
cxxstd: "03,11,14,17,2a"
475485
addrmd: "64"

doc/decimal.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ include::decimal/generic_decimal.adoc[]
2020
include::decimal/decimal32.adoc[]
2121
include::decimal/decimal64.adoc[]
2222
include::decimal/decimal128.adoc[]
23+
include::decimal/fast_types.adoc[]
24+
include::decimal/decimal32_fast.adoc[]
25+
include::decimal/decimal64_fast.adoc[]
26+
include::decimal/decimal128_fast.adoc[]
27+
include::decimal/conversions.adoc[]
2328
include::decimal/literals.adoc[]
2429
include::decimal/numbers.adoc[]
2530
include::decimal/cmath.adoc[]

doc/decimal/benchmarks.adoc

Lines changed: 90 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,29 @@ Run using a Macbook pro with M1 pro chipset running macOS Sonoma 14.4.1 and home
3232
|===
3333
| Type | Runtime (us) | Ratio to `double`
3434
| `float`
35-
| 8764
36-
| 1.577
35+
| 8587
36+
| 1.376
3737
| `double`
38-
| 5559
38+
| 6240
3939
| 1.000
4040
| `decimal32`
41-
| 276,124
42-
| 49.672
41+
| 275,597
42+
| 44.166
4343
| `decimal64`
44-
| 355,999
45-
| 64.760
44+
| 296,929
45+
| 47.587
4646
| `decimal128`
47-
| 989,028
48-
| 177.915
47+
| 821,847
48+
| 131.706
49+
| `decimal32_fast`
50+
| 99,664
51+
| 15.972
52+
| `decimal64_fast`
53+
| 102,132
54+
| 16.367
55+
| `decimal128_fast`
56+
| 146,302
57+
| 23.446
4958
|===
5059

5160
== Basic Operations
@@ -62,83 +71,119 @@ Run using a Macbook pro with M1 pro chipset running macOS Sonoma 14.4.1 and home
6271
|===
6372
| Type | Runtime (us) | Ratio to `double`
6473
| `float`
65-
| 2113
66-
| 0.739
74+
| 2705
75+
| 0.859
6776
| `double`
68-
| 2860
77+
| 3148
6978
| 1.000
7079
| `decimal32`
71-
| 353,836
72-
| 123.719
80+
| 351,505
81+
| 111.660
7382
| `decimal64`
74-
| 409,098
75-
| 143.041
83+
| 359,425
84+
| 114.176
7685
| `decimal128`
77-
| 2,418,039
78-
| 845.468
86+
| 1,446,674
87+
| 459.553
88+
| `decimal32_fast`
89+
| 146,873
90+
| 46.656
91+
| `decimal64_fast`
92+
| 139,294
93+
| 44.248
94+
| `decimal128_fast`
95+
| 707,308
96+
| 224.685
7997
|===
8098

8199
==== Subtraction
82100

83101
|===
84102
| Type | Runtime (us) | Ratio to `double`
85103
| `float`
86-
| 1782
87-
| 1.061
104+
| 3339
105+
| 2.014
88106
| `double`
89-
| 1680
107+
| 1658
90108
| 1.000
91109
| `decimal32`
92-
| 293,927
93-
| 174.957
110+
| 267,646
111+
| 161.427
94112
| `decimal64`
95-
| 329,425
96-
| 196.086
113+
| 303,589
114+
| 183.106
97115
| `decimal128`
98-
| 1,527,261
99-
| 909.084
116+
| 954,211
117+
| 575.519
118+
| `decimal32_fast`
119+
| 147,112
120+
| 88.729
121+
| `decimal64_fast`
122+
| 145,606
123+
| 87.820
124+
| `decimal128_fast`
125+
| 394,538
126+
| 2387.960
100127
|===
101128

102129
==== Multiplication
103130

104131
|===
105132
| Type | Runtime (us) | Ratio to `double`
106133
| `float`
107-
| 1691
108-
| 0.979
134+
| 1646
135+
| 0.957
109136
| `double`
110-
| 1728
137+
| 1720
111138
| 1.000
112139
| `decimal32`
113-
| 309,117
114-
| 178.887
140+
| 313,219
141+
| 182.104
115142
| `decimal64`
116-
| 408,010
117-
| 236.117
143+
| 583,818
144+
| 339.429
118145
| `decimal128`
119-
| 2,506,105
120-
| 1450.292
146+
| 1,881,936
147+
| 1094.149
148+
| `decimal32_fast`
149+
| 86,093
150+
| 50.054
151+
| `decimal64_fast`
152+
| 333,582
153+
| 193.943
154+
| `decimal128_fast`
155+
| 1,269,429
156+
| 738.040
121157
|===
122158

123159
==== Division
124160

125161
|===
126162
| Type | Runtime (us) | Ratio to `double`
127163
| `float`
128-
| 2058
129-
| 0.846
164+
| 2120
165+
| 0.547
130166
| `double`
131-
| 2434
167+
| 3874
132168
| 1.000
133169
| `decimal32`
134-
| 304,852
135-
| 125.247
170+
| 307,337
171+
| 79.333
136172
| `decimal64`
137-
| 519,990
138-
| 213.636
173+
| 447,910
174+
| 115.620
139175
| `decimal128`
140-
| 3,534,909
141-
| 1452.304
176+
| 2,544,798
177+
| 656.892
178+
| `decimal32_fast`
179+
| 105,796
180+
| 27.309
181+
| `decimal64_fast`
182+
| 291,671
183+
| 75.289
184+
| `decimal128_fast`
185+
| 302,003
186+
| 77.956
142187
|===
143188

144189
== Selected Special Functions

doc/decimal/cmath.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,14 @@ constexpr boost::decimal::detail::uint128 frexpd128(decimal128 num, int* expptr)
458458

459459
This function is very similar to https://en.cppreference.com/w/cpp/numeric/math/frexp[frexp], but returns the significand and an integral power of 10 since the `FLT_RADIX` of this type is 10.
460460
The significand is normalized to the number of digits of precision the type has (e.g. for decimal32 it is [1'000'000, 9'999'999]).
461+
462+
=== trunc_to
463+
464+
[source, c++]
465+
----
466+
template <typename Decimal>
467+
constexpr Decimal trunc_to(Decimal val, int precision = 0);
468+
----
469+
470+
The function returns the decimal type with number of fractional digits equal to the value of precision.
471+
`trunc_to` is similar to https://en.cppreference.com/w/cpp/numeric/math/trunc[trunc], and with the default precision argument of 0 it is identical.

doc/decimal/config.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ constexpr decimal64 half {5, -1};
2525
std::complex<decimal64> test_val {half, half};
2626
const auto res = std::acos(test_val);
2727
----
28+
29+
- `BOOST_DECIMAL_FAST_MATH` performs optimizations similar to that of the `-ffast-math` compiler flag such as removing all checks for non-finite values.
30+
This flag increases the performance of the basis operations (e.g. add, sub, mul, div, and comparisons) by up to 20%.

0 commit comments

Comments
 (0)