Python math function - nextafter() Last Updated : 12 Nov, 2020 Comments Improve Suggest changes Like Article Like Report math.nextafter() is a function introduced in python 3.9.0. nextafter(x,y) returns the next float value after x towards y, if x is equal to y then y is returned. Syntax: math.nextafter(x, y) Parameter: x and y are two integers/floating point values. Returns: Return the next floating-point value after x towards y. If x is equal to y, return y. Example 1: math.nextafter(x, math.inf) goes up: towards positive infinity. Python3 import math print(math.nextafter(2, math.inf)) Output: 2.0000000000000004 Example 2: math.nextafter(x, -math.inf) goes down: towards minus infinity. Python3 import math print(math.nextafter(2, -math.inf)) Output: 1.9999999999999998 Example 3: math.nextafter(x, 0.0) goes towards zero. Python3 import math print(math.nextafter(2, 0.0)) Output: 2.0000000000000004 Comment More infoAdvertise with us Next Article Python math function - nextafter() M MuskanKalra1 Follow Improve Article Tags : Technical Scripter Python DSA Technical Scripter 2020 Python math-library Python math-library-functions +2 More Practice Tags : python Similar Reads Python Inner Functions In Python, a function inside another function is called an inner function or nested function. Inner functions help in organizing code, improving readability and maintaining encapsulation. They can access variables from the outer function, making them useful for implementing closures and function dec 5 min read Python | How to get function name ? One of the most prominent styles of coding is following the OOP paradigm. For this, nowadays, stress has been to write code with modularity, increase debugging, and create a more robust, reusable code. This all encouraged the use of different functions for different tasks, and hence we are bound to 3 min read 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 : 1 min read Higher Order Functions in Python In Python, Higher Order Functions (HOFs) play an important role in functional programming and allow for writing more modular, reusable and readable code. A Higher-Order Function is a function that either:Takes another function as an argumentReturns a function as a resultExample:Pythondef greet(func) 5 min read Python Functions Python Functions is a block of statements that does a specific task. The idea is to put some commonly or repeatedly done task together and make a function so that instead of writing the same code again and again for different inputs, we can do the function calls to reuse code contained in it over an 9 min read Like