From aa262a74d0bcbc27497b789e2e86a3a2778d4f86 Mon Sep 17 00:00:00 2001 From: Ilia Date: Mon, 9 May 2022 19:05:45 +0300 Subject: [PATCH] style: rename constants --- wasm/src/lib.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 3a291f8..e04742c 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -8,10 +8,9 @@ pub struct Mandelbrot { pixels_count: usize, } -/// modulo -const R: f64 = 2.0; +const ESCAPE_MODULUS: f64 = 2.0; /// number of iterations -const N: u16 = 100; +const DEPTH: u16 = 100; /// complex zero const Z0: Complex = Complex::new(0.0, 0.0); @@ -84,10 +83,10 @@ fn check_series(x: f64, i: f64) -> f32 { let point = Complex::new(x, i); let mut num = Z0 + point; - for step in 0..N { - if num.norm() >= R { + for step in 0..DEPTH { + if num.norm() >= ESCAPE_MODULUS { // calculate percent of step - return step as f32 / N as f32; + return step as f32 / DEPTH as f32; } num = num.powu(2) + point;