Here is the code:
exp = 1.79
def calc(t):
return pow(t - 1, exp)
The input values of t
range from 0 to 1 (e.g. 0.04). This code throws a "math domain exception," but I'm not sure why.
How can I solve this?
If t
ranges from 0 to 1, then t - 1
ranges from -1 to 0. Negative numbers cannot be raised to a fractional power, neither by pow
builtin nor math.pow
.