math.pow vs pow
Tim Peters
tim.one at comcast.net
Thu Nov 27 23:48:50 EST 2003
More information about the Python-list mailing list
Thu Nov 27 23:48:50 EST 2003
- Previous message (by thread): math.pow vs pow
- Next message (by thread): math.pow vs pow
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Clueless Moron] > Perhaps, but why should pow() be different from math.pow() in python? The math module wraps the platform C library math functions of the same names; math.pow() is most useful if you need (or just want) high compatibility with C extensions calling C's pow(). __builtin__.pow() is the implementation of Python's infix ** operator, and deals with complex numbers, unbounded integer powers, and modular exponentiation too (the C pow() doesn't handle any of those). Over the years, just a few of the math module functions have gotten a bit smarter than their C namesakes. The primary example is that math.log() family in recent Pythons returns a sensible result when passed an integer larger than the biggest platform C double; e.g., >>> import math >>> math.log10(10**4000) 4000.0 >>>
- Previous message (by thread): math.pow vs pow
- Next message (by thread): math.pow vs pow
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list