Skip to content

Commit 3976725

Browse files
authored
Merge pull request #698 from cppalliance/develop
Merge to master for 2.1.0
2 parents 6d088b3 + 2c81047 commit 3976725

Some content is hidden

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

81 files changed

+4552
-2167
lines changed

.drone.jsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
2828
{
2929
name: "everything",
3030
image: image,
31+
privileged: true,
3132
environment: environment,
3233
commands:
3334
[

.drone/drone.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@ python tools/boostdep/depinst/depinst.py -I example $LIBRARY
2424
./bootstrap.sh
2525
./b2 -d0 headers
2626

27+
if [[ $(uname) == "Linux" ]]; then
28+
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
29+
fi
30+
2731
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
2832
./b2 -j3 libs/$LIBRARY/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+undefined-sanitizer=norecover debug-symbols=on} ${ASAN:+address-sanitizer=norecover debug-symbols=on} ${CXXFLAGS:+cxxflags=$CXXFLAGS} ${CXXSTDDIALECT:+cxxstd-dialect=$CXXSTDDIALECT} ${LINKFLAGS:+linkflags=$LINKFLAGS}

.github/workflows/codecov.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ------------------------------------------------------------------------------
2-
# Copyright Matt Borland 2023.
3-
# Copyright Christopher Kormanyos 2023.
2+
# Copyright Matt Borland 2023 - 2024.
3+
# Copyright Christopher Kormanyos 2023 - 2024.
44
# Distributed under the Boost Software License,
55
# Version 1.0. (See accompanying file LICENSE_1_0.txt
66
# or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -66,7 +66,8 @@ jobs:
6666
- name: upload-codecov
6767
uses: codecov/codecov-action@v4
6868
with:
69-
files: ./test/cover/coverage.info
69+
plugin: gcov
70+
file: ${{ runner.workspace }}/decimal/test/cover/coverage.info
7071
token: ${{ secrets.CODECOV_TOKEN }}
7172
fail_ci_if_error: true
72-
functionalities: fix
73+
verbose: false

include/boost/decimal/charconv.hpp

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ namespace detail {
3939
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE TargetDecimalType>
4040
constexpr auto from_chars_general_impl(const char* first, const char* last, TargetDecimalType& value, chars_format fmt) noexcept -> from_chars_result
4141
{
42-
using significand_type = std::conditional_t<std::is_same<TargetDecimalType, decimal128>::value, detail::uint128, std::uint64_t>;
42+
using significand_type = std::conditional_t<std::is_same<TargetDecimalType, decimal128>::value ||
43+
std::is_same<TargetDecimalType, decimal128_fast>::value, detail::uint128, std::uint64_t>;
4344

4445
if (first >= last)
4546
{
@@ -714,6 +715,11 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_hex_impl(char* first, char* last, const Ta
714715
return to_chars_integer_impl<std::uint32_t, std::uint32_t>(first, last, static_cast<std::uint32_t>(abs_exp), 10);
715716
}
716717

718+
#ifdef _MSC_VER
719+
# pragma warning(push)
720+
# pragma warning(disable: 4702) // Unreachable code
721+
#endif
722+
717723
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE TargetDecimalType>
718724
BOOST_DECIMAL_CONSTEXPR auto to_chars_impl(char* first, char* last, TargetDecimalType value, chars_format fmt = chars_format::general, int precision = -1) noexcept -> to_chars_result
719725
{
@@ -730,28 +736,26 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_impl(char* first, char* last, TargetDecima
730736

731737
constexpr auto min_fractional_value = TargetDecimalType{1, -4};
732738

733-
if (fmt == chars_format::hex)
734-
{
735-
return to_chars_hex_impl(first, last, value, precision);
736-
}
737-
738739
// Unspecified precision so we always go with the shortest representation
739740
if (precision == -1)
740741
{
741-
if (fmt == chars_format::general || fmt == chars_format::fixed)
742+
switch (fmt)
742743
{
743-
if (abs_value >= 1 && abs_value < max_fractional_value)
744-
{
744+
case chars_format::general:
745+
if (abs_value >= 1 && abs_value < max_fractional_value)
746+
{
747+
return to_chars_fixed_impl(first, last, value, fmt, precision);
748+
}
749+
else
750+
{
751+
return to_chars_scientific_impl(first, last, value, fmt, precision);
752+
}
753+
case chars_format::fixed:
745754
return to_chars_fixed_impl(first, last, value, fmt, precision);
746-
}
747-
else
748-
{
755+
case chars_format::scientific:
749756
return to_chars_scientific_impl(first, last, value, fmt, precision);
750-
}
751-
}
752-
else
753-
{
754-
return to_chars_scientific_impl(first, last, value, fmt, precision);
757+
case chars_format::hex:
758+
return to_chars_hex_impl(first, last, value, precision); // LCOV_EXCL_LINE unreachable
755759
}
756760
}
757761
else
@@ -766,13 +770,25 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_impl(char* first, char* last, TargetDecima
766770
{
767771
return to_chars_fixed_impl(first, last, value, fmt, precision);
768772
}
773+
else if (fmt == chars_format::hex)
774+
{
775+
return to_chars_hex_impl(first, last, value, precision);
776+
}
769777
else
770778
{
771779
return to_chars_scientific_impl(first, last, value, fmt, precision);
772780
}
773781
}
782+
783+
// LCOV_EXCL_START
784+
return to_chars_scientific_impl(first, last, value, fmt, precision);
785+
// LCOV_EXCL_STOP
774786
}
775787

788+
#ifdef _MSC_VER
789+
# pragma warning(pop)
790+
#endif
791+
776792
} //namespace detail
777793

778794
BOOST_DECIMAL_EXPORT BOOST_DECIMAL_CONSTEXPR auto to_chars(char* first, char* last, decimal32 value) noexcept -> to_chars_result

include/boost/decimal/cmath.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <boost/decimal/detail/cmath/ceil.hpp>
1616
#include <boost/decimal/detail/cmath/cos.hpp>
1717
#include <boost/decimal/detail/cmath/cosh.hpp>
18+
#include <boost/decimal/detail/cmath/ellint_1.hpp>
19+
#include <boost/decimal/detail/cmath/ellint_2.hpp>
1820
#include <boost/decimal/detail/cmath/exp.hpp>
1921
#include <boost/decimal/detail/cmath/exp2.hpp>
2022
#include <boost/decimal/detail/cmath/expm1.hpp>
@@ -69,7 +71,6 @@
6971
#include <boost/decimal/detail/cmath/assoc_laguerre.hpp>
7072
#include <boost/decimal/detail/cmath/legendre.hpp>
7173
#include <boost/decimal/detail/cmath/assoc_legendre.hpp>
72-
#include <boost/decimal/detail/cmath/ellint_1.hpp>
7374
#include <boost/decimal/detail/cmath/trunc_to.hpp>
7475
#include <boost/decimal/detail/cmath/beta.hpp>
7576
#include <boost/decimal/numbers.hpp>

include/boost/decimal/cstdlib.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ inline auto strtod_impl(const char* str, char** endptr) noexcept -> TargetDecima
8787
if (str == nullptr)
8888
{
8989
errno = EINVAL;
90-
return std::numeric_limits<TargetDecimalType>::signaling_NaN();
90+
return std::numeric_limits<TargetDecimalType>::quiet_NaN();
9191
}
9292

9393
const auto str_length {std::strlen(str)};
@@ -106,7 +106,7 @@ inline auto strtod_impl(const char* str, char** endptr) noexcept -> TargetDecima
106106
// Hard to get coverage on memory exhaustion
107107
// LCOV_EXCL_START
108108
errno = ENOMEM;
109-
return std::numeric_limits<TargetDecimalType>::signaling_NaN();
109+
return std::numeric_limits<TargetDecimalType>::quiet_NaN();
110110
// LCOV_EXCL_STOP
111111
}
112112

@@ -126,7 +126,7 @@ inline auto wcstod_calculation(const wchar_t* str, wchar_t** endptr, char* buffe
126126
if (BOOST_DECIMAL_UNLIKELY(val > 255))
127127
{
128128
// Character can not be converted
129-
return std::numeric_limits<TargetDecimalType>::signaling_NaN();
129+
return std::numeric_limits<TargetDecimalType>::quiet_NaN();
130130
}
131131

132132
buffer[i] = static_cast<char>(val);
@@ -150,7 +150,7 @@ inline auto wcstod_impl(const wchar_t* str, wchar_t** endptr) noexcept -> Target
150150
if (str == nullptr)
151151
{
152152
errno = EINVAL;
153-
return std::numeric_limits<TargetDecimalType>::signaling_NaN();
153+
return std::numeric_limits<TargetDecimalType>::quiet_NaN();
154154
}
155155

156156
const auto str_length {detail::strlen(str)};
@@ -169,7 +169,7 @@ inline auto wcstod_impl(const wchar_t* str, wchar_t** endptr) noexcept -> Target
169169
// Hard to get coverage on memory exhaustion
170170
// LCOV_EXCL_START
171171
errno = ENOMEM;
172-
return std::numeric_limits<TargetDecimalType>::signaling_NaN();
172+
return std::numeric_limits<TargetDecimalType>::quiet_NaN();
173173
// LCOV_EXCL_STOP
174174
}
175175

0 commit comments

Comments
 (0)