curious problem with large numbers

Chris Fonnesbeck fonnesbeck at gmail.com
Thu Apr 7 15:48:06 EDT 2005


I have been developing a python module for Markov chain Monte Carlo
estimation, in which I frequently compare variable values with a very
large number, that I arbitrarily define as:

inf = 1e10000

However, on Windows (have tried on Mac, Linux) I get the following behaviour:

>>> inf = 1e10000
>>> inf
1.0

while I would have expected:

1.#INF

Smaller numbers, as expected, yield:

>>> inf = 1e100
>>> inf
1e+100

Obviously, I cannot use the former to compare against large (but not
infinite) numbers, at least not to get the result I expect. Has anyone
seen this behaviour?

Thanks,
Chris



More information about the Python-list mailing list