cleanup 'newtons_method'

This commit is contained in:
Simon Gardling 2022-03-22 14:45:10 -04:00
parent 844843531a
commit c02dc63674

View File

@ -151,10 +151,15 @@ pub fn newtons_method(
continue; continue;
} }
// if `ele.y` is NaN, just continue iterating
if ele.y.is_nan() {
continue;
}
let last_ele_y = last_ele_option.unwrap().y; // store this here as it's used multiple times let last_ele_y = last_ele_option.unwrap().y; // store this here as it's used multiple times
// If either are NaN, just continue iterating // if `last_ele.y` is NaN, continue iterating
if last_ele_y.is_nan() | ele.y.is_nan() { if last_ele_y.is_nan() {
continue; continue;
} }