Skip to content
Snippets Groups Projects
Commit db2e9169 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

We should panic on division by zero (#5844)

parent c05ec630
Branches
No related merge requests found
......@@ -167,8 +167,7 @@ impl ops::Div for Fixed64 {
fn div(self, rhs: Self) -> Self::Output {
if rhs.0 == 0 {
let zero = 0;
return Fixed64::from_parts( self.0 / zero);
panic!("attempt to divide by zero");
}
let (n, d) = if rhs.0 < 0 {
(-self.0, rhs.0.abs() as u64)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment