Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
The default error messages on a several math functions are mostly opaque and and unhelpful.
>>> sqrt(-5)Traceback (most recent call last): File "<stdin>", line 1, in <module>ValueError: math domain errorIt would require some effort, but the code could be refactored to give a customized and helpful response, a least in common cases (falling back to the C error code message when the cause is not known):
ValueError: math.sqrt() expects a non-negative input. See cmath.sqrt() for variation that supports complex numbersValueError: math.log() requires a non-negative input.