Does the built-in Python math library basically use C's math library or does Python have a C-independent math library? Also, is the Python math library platform independent?
views:
387answers:
2at the bottom of the page it says:
Note: The
mathmodule consists mostly of thin wrappers around the platform Cmathlibrary functions. Behavior in exceptional cases is loosely specified by the C standards, and Python inherits much of itsmath-function error-reporting behavior from the platform C implementation. As a result, the specific exceptions raised in error cases (and even whether some arguments are considered to be exceptional at all) are not defined in any useful cross-platform or cross-release way. For example, whethermath.log(0)returns-Infor raisesValueErrororOverflowErrorisn’t defined, and in cases wheremath.log(0)raisesOverflowError,math.log(0L)may raiseValueErrorinstead.All functions return a quiet NaN if at least one of the args is
NaN. SignalingNaNs raise an exception. The exception type still depends on the platform and libm implementation. It’s usuallyValueErrorforEDOMandOverflowErrorforerrno ERANGE.Changed in version 2.6: In earlier versions of Python the outcome of an operation with
NaNas input depended on platform andlibmimplementation.