Skip to content

Commit 80e758b

Browse files
author
deepshekhardas
committed
fix: add negative input validation to largest_of_very_large_numbers
1 parent c0db072 commit 80e758b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

maths/largest_of_very_large_numbers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def res(x, y):
1717
...
1818
ValueError: expected a positive input
1919
"""
20+
if x < 0 or y < 0:
21+
raise ValueError("expected a positive input")
2022
if 0 not in (x, y):
2123
# We use the relation x^y = y*log10(x), where 10 is the base.
2224
return y * math.log10(x)

0 commit comments

Comments
 (0)