From f76ff642d21c780c1d26af4c8f0e926d7f221fb4 Mon Sep 17 00:00:00 2001 From: Ilia Date: Sun, 17 Apr 2022 13:48:22 +0300 Subject: [PATCH] fix: incorrect calculation this was because of u16 overflow --- wasm/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 2b4ea82..6f3a3b8 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -65,8 +65,8 @@ impl Mandelbrot { let (mut xd, mut yd); for i in 0..len { - xd = ((i as u16) % w) as f64; - yd = ((i as u16) / w) as f64; + xd = (i % w as usize) as f64; + yd = (i / w as usize) as f64; self.pixels[i] = check_series(lx + xd / scale, ty - yd / scale); } }