Skip to content

Commit

Permalink
Merge pull request #661 from cppalliance/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland authored Jun 19, 2024
2 parents 67793ad + 80060d2 commit 6d088b3
Show file tree
Hide file tree
Showing 110 changed files with 14,301 additions and 1,328 deletions.
71 changes: 55 additions & 16 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,44 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
),

linux_pipeline(
"Linux 22.04 GCC 12 32 ASAN",
"Linux 22.04 GCC 12 32 ASAN 03",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03', ADDRMD: '32' } + asan,
"g++-12-multilib",
),

linux_pipeline(
"Linux 22.04 GCC 12 32 ASAN 11",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '11', ADDRMD: '32' } + asan,
"g++-12-multilib",
),

linux_pipeline(
"Linux 22.04 GCC 12 32 ASAN 14",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '14', ADDRMD: '32' } + asan,
"g++-12-multilib",
),

linux_pipeline(
"Linux 22.04 GCC 12 32 ASAN 17",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '17', ADDRMD: '32' } + asan,
"g++-12-multilib",
),

linux_pipeline(
"Linux 22.04 GCC 12 32 ASAN 20",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '20', ADDRMD: '32' } + asan,
"g++-12-multilib",
),

linux_pipeline(
"Linux 22.04 GCC 12 32 ASAN 2b",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '2b', ADDRMD: '32' } + asan,
"g++-12-multilib",
),

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

linux_pipeline(
"Linux 24.04 GCC 14 32/64",
"Linux 24.04 GCC 14 32",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32', CXXFLAGS: "-fexcess-precision=fast" },
"g++-14-multilib",
),

linux_pipeline(
"Linux 24.04 GCC 14 64",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,23', ADDRMD: '64', CXXFLAGS: "-fexcess-precision=fast" },
"g++-14-multilib",
),

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

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

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

macos_pipeline(
"MacOS 10.15 Xcode 12.2 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,2a' } + ubsan,
),

macos_pipeline(
"MacOS 10.15 Xcode 12.2 ASAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,2a' } + asan,
),

macos_pipeline(
"MacOS 12.4 Xcode 13.4.1 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jobs:
cxxstd: "03,11,14,17,20,2b"
os: macos-14

timeout-minutes: 120
timeout-minutes: 180
runs-on: ${{matrix.os}}
container: ${{matrix.container}}

Expand Down Expand Up @@ -456,20 +456,30 @@ jobs:
include:
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
addrmd: "32"
os: windows-2019
- toolset: msvc-14.3
# B2 does not work with MSVC 17.10. Once it's updated we can re-enable these tests
# Still covered in drone
#- toolset: msvc-14.3
# cxxstd: "14,17,20,latest"
# addrmd: "32"
# os: windows-2022
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: "32"
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: "64"
os: windows-2022
os: windows-2019
#- toolset: msvc-14.3
# cxxstd: "14,17,20,latest"
# addrmd: "64"
# os: windows-2022
#- toolset: clang-win
# cxxstd: "14,17,latest"
# addrmd: "32"
# os: windows-2022
#- toolset: clang-win
# cxxstd: "14,17,latest"
# addrmd: "64"
# os: windows-2022
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: "64"
Expand Down
5 changes: 5 additions & 0 deletions doc/decimal.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ include::decimal/generic_decimal.adoc[]
include::decimal/decimal32.adoc[]
include::decimal/decimal64.adoc[]
include::decimal/decimal128.adoc[]
include::decimal/fast_types.adoc[]
include::decimal/decimal32_fast.adoc[]
include::decimal/decimal64_fast.adoc[]
include::decimal/decimal128_fast.adoc[]
include::decimal/conversions.adoc[]
include::decimal/literals.adoc[]
include::decimal/numbers.adoc[]
include::decimal/cmath.adoc[]
Expand Down
135 changes: 90 additions & 45 deletions doc/decimal/benchmarks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,29 @@ Run using a Macbook pro with M1 pro chipset running macOS Sonoma 14.4.1 and home
|===
| Type | Runtime (us) | Ratio to `double`
| `float`
| 8764
| 1.577
| 8587
| 1.376
| `double`
| 5559
| 6240
| 1.000
| `decimal32`
| 276,124
| 49.672
| 275,597
| 44.166
| `decimal64`
| 355,999
| 64.760
| 296,929
| 47.587
| `decimal128`
| 989,028
| 177.915
| 821,847
| 131.706
| `decimal32_fast`
| 99,664
| 15.972
| `decimal64_fast`
| 102,132
| 16.367
| `decimal128_fast`
| 146,302
| 23.446
|===

== Basic Operations
Expand All @@ -62,83 +71,119 @@ Run using a Macbook pro with M1 pro chipset running macOS Sonoma 14.4.1 and home
|===
| Type | Runtime (us) | Ratio to `double`
| `float`
| 2113
| 0.739
| 2705
| 0.859
| `double`
| 2860
| 3148
| 1.000
| `decimal32`
| 353,836
| 123.719
| 351,505
| 111.660
| `decimal64`
| 409,098
| 143.041
| 359,425
| 114.176
| `decimal128`
| 2,418,039
| 845.468
| 1,446,674
| 459.553
| `decimal32_fast`
| 146,873
| 46.656
| `decimal64_fast`
| 139,294
| 44.248
| `decimal128_fast`
| 707,308
| 224.685
|===

==== Subtraction

|===
| Type | Runtime (us) | Ratio to `double`
| `float`
| 1782
| 1.061
| 3339
| 2.014
| `double`
| 1680
| 1658
| 1.000
| `decimal32`
| 293,927
| 174.957
| 267,646
| 161.427
| `decimal64`
| 329,425
| 196.086
| 303,589
| 183.106
| `decimal128`
| 1,527,261
| 909.084
| 954,211
| 575.519
| `decimal32_fast`
| 147,112
| 88.729
| `decimal64_fast`
| 145,606
| 87.820
| `decimal128_fast`
| 394,538
| 2387.960
|===

==== Multiplication

|===
| Type | Runtime (us) | Ratio to `double`
| `float`
| 1691
| 0.979
| 1646
| 0.957
| `double`
| 1728
| 1720
| 1.000
| `decimal32`
| 309,117
| 178.887
| 313,219
| 182.104
| `decimal64`
| 408,010
| 236.117
| 583,818
| 339.429
| `decimal128`
| 2,506,105
| 1450.292
| 1,881,936
| 1094.149
| `decimal32_fast`
| 86,093
| 50.054
| `decimal64_fast`
| 333,582
| 193.943
| `decimal128_fast`
| 1,269,429
| 738.040
|===

==== Division

|===
| Type | Runtime (us) | Ratio to `double`
| `float`
| 2058
| 0.846
| 2120
| 0.547
| `double`
| 2434
| 3874
| 1.000
| `decimal32`
| 304,852
| 125.247
| 307,337
| 79.333
| `decimal64`
| 519,990
| 213.636
| 447,910
| 115.620
| `decimal128`
| 3,534,909
| 1452.304
| 2,544,798
| 656.892
| `decimal32_fast`
| 105,796
| 27.309
| `decimal64_fast`
| 291,671
| 75.289
| `decimal128_fast`
| 302,003
| 77.956
|===

== Selected Special Functions
Expand Down
11 changes: 11 additions & 0 deletions doc/decimal/cmath.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,14 @@ constexpr boost::decimal::detail::uint128 frexpd128(decimal128 num, int* expptr)

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.
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]).

=== trunc_to

[source, c++]
----
template <typename Decimal>
constexpr Decimal trunc_to(Decimal val, int precision = 0);
----

The function returns the decimal type with number of fractional digits equal to the value of precision.
`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.
3 changes: 3 additions & 0 deletions doc/decimal/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ constexpr decimal64 half {5, -1};
std::complex<decimal64> test_val {half, half};
const auto res = std::acos(test_val);
----

- `BOOST_DECIMAL_FAST_MATH` performs optimizations similar to that of the `-ffast-math` compiler flag such as removing all checks for non-finite values.
This flag increases the performance of the basis operations (e.g. add, sub, mul, div, and comparisons) by up to 20%.
Loading

0 comments on commit 6d088b3

Please sign in to comment.