NumPy numpy.inf and numpy.infty

1. numpy.inf

IEEE 754 floating point representation of (positive) infinity.

infinity /ɪnˈfɪnəti/:n. 无穷,无限大,无限距
aliase:n. 别名

1.1. Returns

y : float

A floating point representation of positive infinity.
正无穷大的浮点表示。

NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Also that positive infinity is not equivalent to negative infinity. But infinity is equivalent to positive infinity.
NumPy 使用 IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754)。这意味着 Not a Number 不等于无穷大。同样,正无穷大不等于负无穷大。但是无穷大等于正无穷大。

Inf, Infinity, PINF and infty are aliases for inf.

1.2. Examples

(pt-1.4_py-3.6) yongqiang@yongqiang:~$ python
Python 3.6.10 |Anaconda, Inc.| (default, May  8 2020, 02:54:21)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.inf
inf
>>>
>>> -np.inf
-inf
>>>
>>> np.array([1]) / 0.
array([inf])
>>>
>>> exit()
(pt-1.4_py-3.6) yongqiang@yongqiang:~$

2. numpy.infty

IEEE 754 floating point representation of (positive) infinity.
IEEE 754 浮点表示 (正) 无穷大。

Use inf because Inf, Infinity, PINF and infty are aliases for inf.
使用 inf 是因为 InfInfinityPINFinftyinf 的别名。

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值