Commit f5033de
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 4d3a7ab commit f5033de
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 | |
|---|---|---|---|
| |||
1536 | 1536 | | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | | - | |
| 1539 | + | |
1540 | 1540 | | |
1541 | 1541 | | |
1542 | 1542 | | |
| |||
0 commit comments