fix: use logical AND instead of bitwise AND in endpoint check

Both operands (`z_mul.is_integer` and `include_right_endpoint`) are
boolean types, making logical AND (`&&`) the semantically correct
choice over bitwise AND (`&`).

Using `&&` ensures proper short-circuit evaluation and prevents latent
logic bugs if these variables are refactored into integral types or
bitmasks in the future.

Signed-off-by: Yuming He <ComixHe1895@outlook.com>
This commit is contained in:
Yuming He 2026-06-23 21:36:20 +08:00
parent 588b3a0f8f
commit 4379eaabd3
No known key found for this signature in database
GPG Key ID: A184612DF59E3C3D

View File

@ -1338,7 +1338,7 @@ template <typename T> auto to_decimal(T x) noexcept -> decimal_fp<T> {
if (r < deltai) {
// Exclude the right endpoint if necessary.
if (r == 0 && (z_mul.is_integer & !include_right_endpoint)) {
if (r == 0 && (z_mul.is_integer && !include_right_endpoint)) {
--ret_value.significand;
r = float_info<T>::big_divisor;
goto small_divisor_case_label;