diff --git a/src/lib.rs b/src/lib.rs index 374eb83..0f54f54 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ fn integral_rectangles( .map(|e| { let x: f32 = ((e as f32) * step) + min_x; + // Makes sure rectangles are properly handled on x values below 0 let x2: f32 = match x > 0.0 { true => x + step, false => x - step, @@ -27,6 +28,7 @@ fn integral_rectangles( let tmp1: f32 = func(x as f64) as f32; let tmp2: f32 = func(x2 as f64) as f32; + // Chooses the y value who's absolute value is the smallest let y: f32 = match tmp2.abs() > tmp1.abs() { true => tmp1, false => tmp2, diff --git a/www/index.js b/www/index.js index fc75097..b7a21e4 100644 --- a/www/index.js +++ b/www/index.js @@ -25,7 +25,7 @@ export function main() { /** This function is used in `bootstrap.js` to setup imports. */ export function setup(WasmChart) { ChartManager = WasmChart; - ChartManager.init_panic_hook(); + ChartManager.init_panic_hook(); // Allows `panic!()` to log in the browser's console } /** Add event listeners. */