diff --git a/src/misc.rs b/src/misc.rs index 807fe51..89d4596 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -88,14 +88,11 @@ pub fn newtons_method( // If below threshold, break if (x2 - x1).abs() < threshold { - break; + return Some(x2); } x1 = x2; } - - // return x2 as loop breaks before x1 is set to x2 - Some(x2) } /// Inputs `Vec>` and outputs a `String` containing a pretty representation of the Vector