Skip to content
Prev Previous commit
Next Next commit
fix readability
  • Loading branch information
Rohan Jain committed Jan 4, 2024
commit 9913c428b5899e7d9769f16b0a6e6991f5b7053f
9 changes: 5 additions & 4 deletions pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,14 @@ def floordiv_compat(
# GH 56676: avoid storing intermediate calculating in
# floating point type.
has_remainder = pc.not_equal(pc.multiply(divided, right), left)
has_one_negative_operand = pc.less(
pc.bit_wise_xor(left, right),
pa.scalar(0, type=divided.type),
)
result = pc.if_else(
pc.and_(
has_remainder,
pc.less(
pc.bit_wise_xor(left, right),
pa.scalar(0, type=divided.type),
),
has_one_negative_operand,
),
# GH 55561: floordiv should round towards negative infinity.
# pc.divide_checked for integral types rounds towards 0.
Expand Down