Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 83a4f69

Browse files
authored
Merge pull request #333 from toughengineer/made_function_non-template
Made function non-template
2 parents 7262d94 + 1ea4d25 commit 83a4f69

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

‎include/fast_float/digit_comparison.h‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ constexpr static uint64_t powers_of_ten_uint64[] = {1UL,
3838
// this algorithm is not even close to optimized, but it has no practical
3939
// effect on performance: in order to have a faster algorithm, we'd need
4040
// to slow down performance for faster algorithms, and this is still fast.
41-
template <typename UC>
4241
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 int32_t
43-
scientific_exponent(parsed_number_string_t<UC> &num) noexcept {
44-
uint64_t mantissa = num.mantissa;
45-
int32_t exponent = int32_t(num.exponent);
42+
scientific_exponent(uint64_t mantissa, int32_t exponent) noexcept {
4643
while (mantissa >= 10000) {
4744
mantissa /= 10000;
4845
exponent += 4;
@@ -398,7 +395,7 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp(
398395
FASTFLOAT_ASSERT(real_digits.pow2(uint32_t(-pow2_exp)));
399396
}
400397

401-
// compare digits, and use it to director rounding
398+
// compare digits, and use it to direct rounding
402399
int ord = real_digits.compare(theor_digits);
403400
adjusted_mantissa answer = am;
404401
round<T>(answer, [ord](adjusted_mantissa &a, int32_t shift) {
@@ -419,7 +416,7 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp(
419416
return answer;
420417
}
421418

422-
// parse the significant digits as a big integer to unambiguously round the
419+
// parse the significant digits as a big integer to unambiguously round
423420
// the significant digits. here, we are trying to determine how to round
424421
// an extended float representation close to `b+h`, halfway between `b`
425422
// (the float rounded-down) and `b+u`, the next positive float. this
@@ -438,7 +435,8 @@ digit_comp(parsed_number_string_t<UC> &num, adjusted_mantissa am) noexcept {
438435
// remove the invalid exponent bias
439436
am.power2 -= invalid_am_bias;
440437

441-
int32_t sci_exp = scientific_exponent(num);
438+
int32_t sci_exp =
439+
scientific_exponent(num.mantissa, static_cast<int32_t>(num.exponent));
442440
size_t max_digits = binary_format<T>::max_digits();
443441
size_t digits = 0;
444442
bigint bigmant;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /