加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

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

发布时间:2020-12-20 11:11:21 所属栏目:Python 来源:网络整理
导读:内置的 Python数学库基本上是使用C的数学库吗?还是Python有一个独立于C的数学库?此外,Python数学库平台是独立的吗? 解决方法 在 the page it says的底部: Note: The math module consists mostly of thin wrappers around the platform C math library f
内置的 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读