diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index 4d8aa88..e5c08be 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -23,10 +23,11 @@ namespace detail { template from_chars_result_t FASTFLOAT_CONSTEXPR14 parse_infnan(UC const *first, UC const *last, - T &value, const chars_format fmt) noexcept { + T &value, + const chars_format fmt) noexcept { from_chars_result_t answer{}; answer.ptr = first; - answer.ec = std::errc(); // be optimistic + answer.ec = std::errc(); // be optimistic FASTFLOAT_ASSUME(first < last); // so dereference without checks bool const minusSign = (*first == UC('-')); @@ -254,9 +255,9 @@ from_chars_advanced(parsed_number_string_t const &pns, T &value) noexcept { if (pns.mantissa == 0) { value = #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN - pns.negative ? T(-0.) : + pns.negative ? T(-0.) : #endif - T(0.); + T(0.); return answer; } #endif @@ -286,9 +287,9 @@ from_chars_advanced(parsed_number_string_t const &pns, T &value) noexcept { } to_float( #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN - pns.negative, + pns.negative, #endif - am, value); + am, value); // Test for over/underflow. if ((pns.mantissa != 0 && am.mantissa == 0 && am.power2 == 0) || am.power2 == binary_format::infinite_power()) { @@ -329,7 +330,7 @@ from_chars_float_advanced(UC const *first, UC const *last, T &value, ? parse_number_string(first, last, options) : #endif - parse_number_string(first, last, options); + parse_number_string(first, last, options); if (!pns.valid) { #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN if (uint64_t(options.format & chars_format::no_infnan)) { diff --git a/tests/basictest.cpp b/tests/basictest.cpp index f2cba7f..cbeb11e 100644 --- a/tests/basictest.cpp +++ b/tests/basictest.cpp @@ -656,8 +656,7 @@ TEST_CASE("decimal_point_parsing") { answer = fast_float::from_chars_advanced( input.data(), input.data() + input.size(), result, - fast_float::parse_options(fast_float::chars_format::general, ',', 10) - ); + fast_float::parse_options(fast_float::chars_format::general, ',', 10)); CHECK_MESSAGE(answer.ec == std::errc(), "expected parse success"); CHECK_MESSAGE(answer.ptr == input.data() + input.size(), "Parsing should have stopped at end"); @@ -667,8 +666,7 @@ TEST_CASE("decimal_point_parsing") { std::string const input = "1.25"; auto answer = fast_float::from_chars_advanced( input.data(), input.data() + input.size(), result, - fast_float::parse_options(fast_float::chars_format::general, ',', 10) - ); + fast_float::parse_options(fast_float::chars_format::general, ',', 10)); CHECK_MESSAGE(answer.ec == std::errc(), "expected parse success"); CHECK_MESSAGE(answer.ptr == input.data() + 1, "Parsing should have stopped at dot"); @@ -676,8 +674,7 @@ TEST_CASE("decimal_point_parsing") { answer = fast_float::from_chars_advanced( input.data(), input.data() + input.size(), result, - fast_float::parse_options{} - ); + fast_float::parse_options{}); CHECK_MESSAGE(answer.ec == std::errc(), "expected parse success"); CHECK_MESSAGE(answer.ptr == input.data() + input.size(), "Parsing should have stopped at end");