@@ -2106,15 +2106,21 @@ void integer_multiplication_by_power_of_10_test(Int mantissa,
2106
2106
}
2107
2107
2108
2108
template <typename Int>
2109
- void verify_integer_multiplication_by_power_of_10 (Int mantissa, int32_t decimal_exponent) {
2110
- std::string constructed_string = std::to_string (mantissa) + " e" + std::to_string (decimal_exponent);
2111
- double expected_result;
2112
- auto result = fast_float::from_chars (constructed_string.data (), constructed_string.data () + constructed_string.size (), expected_result);
2113
- if (result.ec != std::errc ()) {
2114
- INFO (" Failed to parse: " << constructed_string);
2115
- }
2116
- std::cout << " Testing: " << constructed_string << " -> " << fHexAndDec (expected_result) << " \n " ;
2117
- integer_multiplication_by_power_of_10_test (mantissa, decimal_exponent, expected_result);
2109
+ void verify_integer_multiplication_by_power_of_10 (Int mantissa,
2110
+ int32_t decimal_exponent) {
2111
+ std::string constructed_string =
2112
+ std::to_string (mantissa) + " e" + std::to_string (decimal_exponent);
2113
+ double expected_result;
2114
+ auto result = fast_float::from_chars (
2115
+ constructed_string.data (),
2116
+ constructed_string.data () + constructed_string.size (), expected_result);
2117
+ if (result.ec != std::errc ()) {
2118
+ INFO (" Failed to parse: " << constructed_string);
2119
+ }
2120
+ std::cout << " Testing: " << constructed_string << " -> "
2121
+ << fHexAndDec (expected_result) << " \n " ;
2122
+ integer_multiplication_by_power_of_10_test (mantissa, decimal_exponent,
2123
+ expected_result);
2118
2124
}
2119
2125
2120
2126
TEST_CASE (" multiply_integer_and_power_of_10" ) {
@@ -2158,18 +2164,20 @@ TEST_CASE("multiply_integer_and_power_of_10") {
2158
2164
verify_integer_multiplication_by_power_of_10 (1 , -1 );
2159
2165
verify_integer_multiplication_by_power_of_10 (-1 , -1 );
2160
2166
2161
- integer_multiplication_by_power_of_10_test<uint64_t >(49406564584124654 , -340 ,
2162
- DBL_TRUE_MIN);
2163
- integer_multiplication_by_power_of_10_test<uint64_t >(22250738585072014 , -324 ,
2164
- DBL_MIN);
2165
- integer_multiplication_by_power_of_10_test<uint64_t >(17976931348623158 , 292 , DBL_MAX);
2167
+ integer_multiplication_by_power_of_10_test<uint64_t >(49406564584124654 ,
2168
+ -340 , DBL_TRUE_MIN);
2169
+ integer_multiplication_by_power_of_10_test<uint64_t >(22250738585072014 ,
2170
+ -324 , DBL_MIN);
2171
+ integer_multiplication_by_power_of_10_test<uint64_t >(17976931348623158 , 292 ,
2172
+ DBL_MAX);
2166
2173
2167
2174
// DBL_TRUE_MIN / 2 underflows to 0
2168
- integer_multiplication_by_power_of_10_test<uint64_t >(49406564584124654 / 2 , -340 , 0 .);
2175
+ integer_multiplication_by_power_of_10_test<uint64_t >(49406564584124654 / 2 ,
2176
+ -340 , 0 .);
2169
2177
2170
2178
// DBL_TRUE_MIN / 2 + 0.0000000000000001e-324 rounds to DBL_TRUE_MIN
2171
- integer_multiplication_by_power_of_10_test<uint64_t >(49406564584124654 / 2 + 1 , - 340 ,
2172
- DBL_TRUE_MIN);
2179
+ integer_multiplication_by_power_of_10_test<uint64_t >(
2180
+ 49406564584124654 / 2 + 1 , - 340 , DBL_TRUE_MIN);
2173
2181
2174
2182
// DBL_MAX + 0.0000000000000001e308 overflows to infinity
2175
2183
integer_multiplication_by_power_of_10_test<uint64_t >(
@@ -2192,14 +2200,22 @@ TEST_CASE("multiply_integer_and_power_of_10") {
2192
2200
verify_integer_multiplication_by_power_of_10<uint64_t >(1234567890123 , 42 );
2193
2201
verify_integer_multiplication_by_power_of_10<uint64_t >(12345678901234 , 42 );
2194
2202
verify_integer_multiplication_by_power_of_10<uint64_t >(123456789012345 , 42 );
2195
- verify_integer_multiplication_by_power_of_10<uint64_t >(1234567890123456 , 42 );
2196
- verify_integer_multiplication_by_power_of_10<uint64_t >(12345678901234567 , 42 );
2197
- verify_integer_multiplication_by_power_of_10<uint64_t >(123456789012345678 , 42 );
2198
- verify_integer_multiplication_by_power_of_10<uint64_t >(1234567890123456789 , 42 );
2199
- verify_integer_multiplication_by_power_of_10<uint64_t >(12345678901234567890ULL , 42 );
2203
+ verify_integer_multiplication_by_power_of_10<uint64_t >(1234567890123456 ,
2204
+ 42 );
2205
+ verify_integer_multiplication_by_power_of_10<uint64_t >(12345678901234567 ,
2206
+ 42 );
2207
+ verify_integer_multiplication_by_power_of_10<uint64_t >(123456789012345678 ,
2208
+ 42 );
2209
+ verify_integer_multiplication_by_power_of_10<uint64_t >(1234567890123456789 ,
2210
+ 42 );
2211
+ verify_integer_multiplication_by_power_of_10<uint64_t >(
2212
+ 12345678901234567890ULL , 42 );
2200
2213
// ULLONG_MAX
2201
- verify_integer_multiplication_by_power_of_10<uint64_t >(18446744073709551615ULL , 42 );
2202
- verify_integer_multiplication_by_power_of_10<int64_t >(std::numeric_limits<int64_t >::max (), 42 );
2203
- verify_integer_multiplication_by_power_of_10<int64_t >(std::numeric_limits<int64_t >::min (), 42 );
2214
+ verify_integer_multiplication_by_power_of_10<uint64_t >(
2215
+ 18446744073709551615ULL , 42 );
2216
+ verify_integer_multiplication_by_power_of_10<int64_t >(
2217
+ std::numeric_limits<int64_t >::max (), 42 );
2218
+ verify_integer_multiplication_by_power_of_10<int64_t >(
2219
+ std::numeric_limits<int64_t >::min (), 42 );
2204
2220
}
2205
2221
}
0 commit comments