I'm writing a function to take the exponent of a large number:
def exp_large_float(x):
return np.exp(np.float128(np.array([x])))
result = exp_large_float(800.)
print(result)
>>> [2.72637457e+347]
print(result.dtype)
>>> float128
I'm testing that result
is what I intend so I want to create a "ground truth" array and compare it to the output of exp_large_float
:
ground_truth = np.float128(2.72637457e+347)
print(ground_truth)
>>> inf
Why is that I'm able to successfully return a np.float128
of 2.72637457e+347
but when I try to create this same thing in numpy
I just get inf
?
I'm using python version 2.7.15.