How to represent the infinite ?

Tim Peters tim.one at comcast.net
Fri Jun 21 18:19:25 EDT 2002


[Christophe Delord]
> ...
> But addition, multiplication and exponentiation seem to be implemented
> differently (1e300+1e300 is inf and 1e300**2 is an overflow).

Python float + and * are done via C + and * on C doubles.  Python float **
is done via C libm pow(), and

    x**y

strives to act the same as

    import math
    math.pow(x, y)


> Is there a reason for these different behaviours?

Of course.  The question is whether they're rational reasons <0.9 wink>.






More information about the Python-list mailing list