From 26000b06c8f76faec807c6e966f19bb6b2ae07ac Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 23 Mar 2022 23:22:10 -0400 Subject: [PATCH] fix resolution_helper --- src/function.rs | 2 +- src/misc.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/function.rs b/src/function.rs index 4c820f6..3908fac 100644 --- a/src/function.rs +++ b/src/function.rs @@ -168,7 +168,7 @@ impl FunctionEntry { width_changed: bool, settings: AppSettings, ) -> f64 { let resolution: f64 = pixel_width as f64 / (max_x.abs() + min_x.abs()); - let resolution_iter = resolution_helper(pixel_width, min_x, resolution); + let resolution_iter = resolution_helper(pixel_width + 1, min_x, resolution); // Makes sure proper arguments are passed when integral is enabled if self.integral && settings.integral_changed { diff --git a/src/misc.rs b/src/misc.rs index e1b8912..359e3b6 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -227,7 +227,7 @@ pub fn newtons_method( // Returns a vector of length `max_i` starting at value `min_x` with resolution // of `resolution` pub fn resolution_helper(max_i: usize, min_x: f64, resolution: f64) -> Vec { - (0..=max_i) + (0..max_i) .map(|x| (x as f64 / resolution as f64) + min_x) .collect() }