diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 17e09fe..c3ea406 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -15,7 +15,6 @@ const N: i16 = 100; const Z0: Complex = Complex::new(0.0, 0.0); const IS_IN: u8 = 255; -const IS_NOT_IN: u8 = 0; #[wasm_bindgen] impl Mandelbrot { @@ -88,9 +87,9 @@ fn check_series(x: f64, i: f64) -> u8 { let point = Complex::new(x, i); let mut num = Z0 + point; - for _ in 0..N { + for i in 0..N { if num.norm() >= R as f64 { - return IS_NOT_IN; + return i as u8; } num = num.powu(2) + point;