Math domain error
Closed this issue · 1 comments
prjemian commented
CI for apstools encounters a math domain error occasionally. This line:
pysumreg/pysumreg/sum_registers.py
Line 192 in 7d4381e
Calling code is the problem yet the reporting here could be more informative (such as checking for negative argument to math.sqrt()
or (n-1) < 1
.
prjemian commented
Note:
In [1]: import math
In [2]: math.sqrt(1)
Out[2]: 1.0
In [3]: math.sqrt(0)
Out[3]: 0.0
In [4]: math.sqrt(1/0)
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
Cell In[4], line 1
----> 1 math.sqrt(1/0)
ZeroDivisionError: division by zero
In [5]: math.sqrt(-1)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[5], line 1
----> 1 math.sqrt(-1)
ValueError: math domain error
Only one possibility for a math domain error.