src/iterate.rs

branch
dev
changeset 87
72968cf30033
parent 51
92ef745ec8db
--- a/src/iterate.rs	Mon Dec 30 15:46:28 2024 -0500
+++ b/src/iterate.rs	Sun Jan 19 16:49:09 2025 +0100
@@ -451,6 +451,11 @@
     /// * every 10 iterations from there on until 100 iterations,
     /// * every 100 iteartinos frmo there on until 1000 iterations, etc.
     Logarithmic(usize),
+    /// Same as `Logarithmic`, but $\log_b(n)$ is replaced by $min\{c, \log_b(n)\}$ where $c$
+    /// is the given `cap`. For example, with `base=10` and `cap=2`, the first ten iterations
+    /// will be output, then every tenth iteration, and after 100 iterations, every 100th iteration,
+    /// without further logarithmic progression.
+    LogarithmicCap{ base : usize, cap : u32 },
 }
 
 impl Verbose {
@@ -467,6 +472,10 @@
                 let every = base.pow((iter as float).log(base as float).floor() as u32);
                 iter % every == 0
             }
+            &Verbose::LogarithmicCap{base, cap} => {
+                let every = base.pow(((iter as float).log(base as float).floor() as u32).min(cap));
+                iter % every == 0
+            }
         }
     }
 }

mercurial