From 4379eaabd35a61c9ae640af914a3a26dda4d64da Mon Sep 17 00:00:00 2001 From: Yuming He Date: Tue, 23 Jun 2026 21:36:20 +0800 Subject: [PATCH] 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 --- include/fmt/format-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index ecd3ffec..7685755d 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -1338,7 +1338,7 @@ template auto to_decimal(T x) noexcept -> decimal_fp { 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::big_divisor; goto small_divisor_case_label;