Skip to main content

All Questions

Tagged with
1 vote
1 answer
242 views

1e400 == 10**400 is False? [duplicate]

In Python, 1e400 evaluates to inf, but 10**400 prints out just fine. Theoretically, 1e(x) is supposed to be 10**x, but why and when does this break down? In a related vein, 1e5 == 10**5 evaluates to ...
ichthyophile's user avatar
1 vote
0 answers
534 views

Avoid Overflow from Exponential With Very large negative numbers python

I am writing a code where I calculate an exponential distribution from data points. When running the code, the exponential resulted in arrays of zero. To avoid overflow, I took the log of the ...
MAJ's user avatar
  • 497
0 votes
2 answers
6k views

Python OverflowError: math range error being raised differently in different runs

My program seems to be crashing almost arbitrarily. My code includes these two lines: z[i, j] = -math.exp(oneminusbeta[j, i]) weights[i,j] = math.exp(beta[j,i] + oneminusbeta[j,i]) I've run my whole ...
user961627's user avatar
  • 12.8k
0 votes
2 answers
243 views

math overflow for a not very overflowing calculation in python

The calculation for which I'm getting the math overflow number is: e2 = math.exp([[-20.7313399283991]]) There are actually more extreme numbers that I've done than this, why is this causing an ...
user961627's user avatar
  • 12.8k