Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Oct 9, 2024
1 parent c74b3b6 commit 846eb0f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions crates/polars-core/src/series/arithmetic/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,17 @@ impl Div for &Series {
list_borrowed::NumericListOp::Div.execute(self, rhs)
},
_ => {
let (lhs, rhs) = coerce_lhs_rhs(self, rhs)?;
lhs.divide(rhs.as_ref())
let leaf_supertype =
try_get_supertype(&self.dtype().leaf_dtype(), &rhs.dtype().leaf_dtype())?;
let leaf_supertype = if leaf_supertype.is_float() {
leaf_supertype
} else {
DataType::Float64
};

let lhs = self.cast(&self.dtype().cast_leaf(leaf_supertype.clone()))?;
let rhs = rhs.cast(&rhs.dtype().cast_leaf(leaf_supertype))?;
lhs.divide(&rhs)
},
},
}
Expand Down

0 comments on commit 846eb0f

Please sign in to comment.