当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python numpy.nextafter()用法及代码示例


numpy.nextafter(arr1,arr2,out = None,where = True,cast ='same_kind',order ='K',dtype = None):此数学函数可帮助用户将arr1之后的下一个浮点值返回给arr2,在元素方面。

参数:
arr1 : [array_like]Input array, values to find next value of.
arr2 : [array_like]Input array, values in which direction to look for.
out : [ndarray, optional]Output array with same dimensions as Input array, placed with result.
**kwargs: Allows you to pass keyword variable length of argument to a function. It is used when we want to handle named argument in a function.
where : [array_like, optional]True value means to calculate the universal functions(ufunc) at that position, False value means to leave the value in the output alone.

返回: next floating-point value of arr1 in the direcrion of arr2.



码:

# Python program illustrating  
# nextafter() method  
import numpy as np  
  
arr1 = 3
arr2 = 4
  
print ("arr1:", arr1) 
print ("arr2:", arr2) 
  
print ("\nCheck sign of arr1:", np.nextafter(arr1, arr2))

输出:

arr1: 3
arr2: 4

Check sign of arr1: 3.0000000000000004


相关用法


注:本文由纯净天空筛选整理自Mohit Gupta_OMG 大神的英文原创作品 numpy.nextafter() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。