mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Simplify Dragonbox implementation
This commit is contained in:
parent
d82e1a108d
commit
8061d9afbe
@ -1346,26 +1346,11 @@ template <typename T> decimal_fp<T> to_decimal(T x) noexcept {
|
|||||||
goto small_divisor_case_label;
|
goto small_divisor_case_label;
|
||||||
} else {
|
} else {
|
||||||
// r == deltai; compare fractional parts.
|
// r == deltai; compare fractional parts.
|
||||||
const carrier_uint two_fl = two_fc - 1;
|
const typename cache_accessor<T>::compute_mul_parity_result x_mul =
|
||||||
|
cache_accessor<T>::compute_mul_parity(two_fc - 1, cache, beta);
|
||||||
|
|
||||||
if (!include_left_endpoint ||
|
if (!(x_mul.parity | (x_mul.is_integer & include_left_endpoint)))
|
||||||
exponent < float_info<T>::case_fc_pm_half_lower_threshold ||
|
goto small_divisor_case_label;
|
||||||
exponent > float_info<T>::divisibility_check_by_5_threshold) {
|
|
||||||
// If the left endpoint is not included, the condition for
|
|
||||||
// success is z^(f) < delta^(f) (odd parity).
|
|
||||||
// Otherwise, the inequalities on exponent ensure that
|
|
||||||
// x is not an integer, so if z^(f) >= delta^(f) (even parity), we in fact
|
|
||||||
// have strict inequality.
|
|
||||||
if (!cache_accessor<T>::compute_mul_parity(two_fl, cache, beta).parity) {
|
|
||||||
goto small_divisor_case_label;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const typename cache_accessor<T>::compute_mul_parity_result x_mul =
|
|
||||||
cache_accessor<T>::compute_mul_parity(two_fl, cache, beta);
|
|
||||||
if (!x_mul.parity && !x_mul.is_integer) {
|
|
||||||
goto small_divisor_case_label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ret_value.exponent = minus_k + float_info<T>::kappa + 1;
|
ret_value.exponent = minus_k + float_info<T>::kappa + 1;
|
||||||
|
|
||||||
|
@ -1276,8 +1276,6 @@ template <> struct float_info<float> {
|
|||||||
static const int small_divisor = 10;
|
static const int small_divisor = 10;
|
||||||
static const int min_k = -31;
|
static const int min_k = -31;
|
||||||
static const int max_k = 46;
|
static const int max_k = 46;
|
||||||
static const int divisibility_check_by_5_threshold = 39;
|
|
||||||
static const int case_fc_pm_half_lower_threshold = -1;
|
|
||||||
static const int shorter_interval_tie_lower_threshold = -35;
|
static const int shorter_interval_tie_lower_threshold = -35;
|
||||||
static const int shorter_interval_tie_upper_threshold = -35;
|
static const int shorter_interval_tie_upper_threshold = -35;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user