Skip to content

Commit

Permalink
fix: incorrect calculation
Browse files Browse the repository at this point in the history
this was because of u16 overflow
  • Loading branch information
istudyatuni committed Apr 17, 2022
1 parent e69a21e commit f76ff64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit f76ff64

Please sign in to comment.