Commit daf6ad8
committed
fix: remove duplicate safe_exp function, use exp_safe instead
Resolves #2149
The codebase had two similar exponentiation functions:
- exp_safe (line 172): Robust implementation with input clamping [-20, 20]
and smart error handling (returns max_value for positive overflow)
- safe_exp (line 1597): Simple wrapper returning 0 on any error
This commit:
- Removes the duplicate safe_exp function from math.rs
- Updates run_epoch.rs to use exp_safe instead
exp_safe is the better choice as it:
1. Clamps input to prevent overflow in the first place
2. Returns max_value (not 0) when large positive inputs overflow
3. Has existing test coverage in tests/math.rs1 parent d9f43e1 commit daf6ad8
2 files changed
+1
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1592 | 1592 | | |
1593 | 1593 | | |
1594 | 1594 | | |
1595 | | - | |
1596 | | - | |
1597 | | - | |
1598 | | - | |
1599 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1477 | 1477 | | |
1478 | 1478 | | |
1479 | 1479 | | |
1480 | | - | |
| 1480 | + | |
1481 | 1481 | | |
1482 | 1482 | | |
1483 | 1483 | | |
| |||
0 commit comments