Skip to content

Commit 40c6a45

Browse files
committed
Check for infinity along with r.ec value
1 parent 970ae03 commit 40c6a45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/boost/decimal/string.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ auto from_string_impl(const std::string& str, std::size_t* idx)
2222
DecimalType val;
2323
const auto r {from_chars(str, val)};
2424

25-
if (r.ec == std::errc::result_out_of_range)
25+
if (r.ec == std::errc::result_out_of_range || val == std::numeric_limits<DecimalType>::infinity())
2626
{
2727
val = std::numeric_limits<DecimalType>::signaling_NaN();
2828
BOOST_DECIMAL_THROW_EXCEPTION(std::out_of_range("Conversion is outside the range of the type"));

0 commit comments

Comments
 (0)