Skip to content

refactor: Simplify expo, decay, and fibo wait generators - #188

Merged
edgarrmondragon merged 1 commit into
mainfrom
refactor/simplify-expo-decay
Jul 24, 2026
Merged

refactor: Simplify expo, decay, and fibo wait generators#188
edgarrmondragon merged 1 commit into
mainfrom
refactor/simplify-expo-decay

Conversation

@edgarrmondragon

@edgarrmondragon edgarrmondragon commented Jul 24, 2026

Copy link
Copy Markdown

Replace per-iteration recomputation (factor * base_n, initial_value * e**(-t*decay_factor), the if/else branch in fibo) with a loop that grows the value multiplicatively until it crosses the cap, then falls into an unconditional loop yielding the capped value. Avoids recomputing the closed-form expression on every yield.

Since decay's multiplicative accumulation can drift slightly from the old direct power computation, the corresponding tests now compare with pytest.approx instead of exact equality.

Replace per-iteration recomputation (`factor * base_n`, `initial_value * e**(-t*decay_factor)`, the `if/else` branch in `fibo`) with a loop that grows the value multiplicatively until it crosses the cap, then falls into an unconditional loop yielding the capped value. Avoids recomputing the closed-form expression on every yield.

Since `decay`'s multiplicative accumulation can drift slightly from the old direct power computation, the corresponding tests now compare with `pytest.approx` instead of exact equality; this also replaces the file-wide float-equality ruff suppression with per-assertion `approx` calls.

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@edgarrmondragon edgarrmondragon self-assigned this Jul 24, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 backoff | 🛠️ Build #33750747 | 📁 Comparing 0e3c9ac against latest (a0b72e8)

  🔍 Preview build  

2 files changed
± changelog.html
± api/reference.html

@edgarrmondragon
edgarrmondragon added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 6d17a47 Jul 24, 2026
20 checks passed
@edgarrmondragon
edgarrmondragon deleted the refactor/simplify-expo-decay branch July 24, 2026 21:48
@edgarrmondragon edgarrmondragon added the internal Internal change with no user-facing impact label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Internal change with no user-facing impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant