fix newtons_method handling of non-finite derivatives

This commit is contained in:
Simon Gardling
2022-05-18 15:01:33 -04:00
parent d665b72a4c
commit 782d567302
2 changed files with 25 additions and 1 deletions

View File

@@ -201,4 +201,22 @@ fn newtons_method() {
&f64::EPSILON,
);
assert_eq!(data, None);
let data = newtons_method(
&|_: f64| f64::INFINITY,
&|x: f64| x.sin(),
&0.0,
&(-10.0..10.0),
&f64::EPSILON,
);
assert_eq!(data, None);
let data = newtons_method(
&|x: f64| x.sin(),
&|_: f64| f64::INFINITY,
&0.0,
&(-10.0..10.0),
&f64::EPSILON,
);
assert_eq!(data, None);
}