Commit 11800c1
maths/largest_of_very_large_numbers: validate positive input
The docstring already documents that res(-1, 5) should raise
`ValueError: expected a positive input`, but no such validation
exists. Calling res() with a negative x currently reaches
`math.log10(x)` and raises `ValueError: math domain error` instead,
so the documented doctest fails.
Add the missing check at the top of the function so it matches
the documented contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c0db072 commit 11800c1
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
0 commit comments