Sunday, June 14, 2026
HomeLanguagesnumpy.nextafter() in Python

numpy.nextafter() in Python

numpy.nextafter(arr1, arr2, out = None, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None) : This mathematical function helps user to return next floating-point value after arr1 towards arr2, element-wise.

Parameters : 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. Return : next floating-point value of arr1 in the direction of arr2.

Code : 

Python3




# 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))


Output : 

arr1 :  3
arr2 :  4

Check sign of arr1 :  3.0000000000000004
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS