gpt4 book ai didi

独立于 C 数学库和平台的 Python 数学库?

转载 作者:太空宇宙 更新时间:2023-11-03 13:24:55 25 4
gpt4 key购买 nike

内置的Python 数学库基本上使用C 的数学库还是Python 有独立于C 的数学库?另外,Python数学库平台独立吗?

最佳答案

the page it says的底部:

Note: The math module consists mostly of thin wrappers around the platform C math library functions. Behavior in exceptional cases is loosely specified by the C standards, and Python inherits much of its math-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, whether math.log(0) returns -Inf or raises ValueError or OverflowError isn’t defined, and in cases where math.log(0) raises OverflowError, math.log(0L) may raise ValueError instead.

All functions return a quiet NaN if at least one of the args is NaN. Signaling NaNs raise an exception. The exception type still depends on the platform and libm implementation. It’s usually ValueError for EDOM and OverflowError for errno ERANGE.

Changed in version 2.6: In earlier versions of Python the outcome of an operation with NaN as input depended on platform and libm implementation.

关于独立于 C 数学库和平台的 Python 数学库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1160061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com