Python - math.ulp(x) function Last Updated : 23 Aug, 2021 Comments Improve Suggest changes Like Article Like Report ULP stands for “Unit in the Last Place”. math.ulp() is introduced in python 3.9.0 version, it returns the value of the least significant bit of the float x. In numerical analysis and computer science, unit of least precision (ULP) or unit in the last place is the spacing between floating-point numbers. Note: If the argument is a NaN (not a number), output is NaN.If input x is negative, output is ulp(-x).If input x is positive infinity, output is inf.If the input is zero, the smallest positive denormalized representable float is the output(smaller than the minimum positive normalized float, sys.float_info.min).If input value x is the largest positive representable float, the value of the least significant bit of x is the output, such that the first float smaller than x is x - ulp(x).Otherwise, if input value x is a positive finite number, the value of the least significant bit of x is the output, such that the first float bigger than x is x + ulp(x). Syntax: math.ulp(x) Parameter: x: float whose ulp is returned Return: Return the value of the least significant bit of the float x. Example: To show the working of math.ulp(x) method. Python3 # python program to explain # math.ulp(x) for different values of x import math import sys # when x is NaN x = float('nan') print(math.ulp(x)) # when x is positive infinity x = float('inf') print(math.ulp(x)) # when x is negative infinity print(math.ulp(-x)) # when x = 0 x = 0.0 print(math.ulp(x)) # when x is maximum representable float x = sys.float_info.max print(math.ulp(x)) # x is a positive finite number x = 5 print(math.ulp(x)) # when x is a negative number x = -5 print(math.ulp(x)) Output: nan inf inf 5e-324 1.99584030953472e+292 8.881784197001252e-16 8.881784197001252e-16 Comment More infoAdvertise with us Next Article Python - math.ulp(x) function 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 | math.floor() function In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.floor() function returns the largest integer not greater than x. If number is already integer, same number is returned. Syntax: math.floor(x) Parameter: x: This is a numeric e 1 min read Python int() Function The Python int() function converts a given object to an integer or converts a decimal (floating-point) number to its integer part by truncating the fractional part.Example:In this example, we passed a string as an argument to the int() function and printed it.Pythonage = "21" print("age =", int(age) 3 min read Python oct() Function Python oct() function takes an integer and returns the octal representation in a string format. In this article, we will see how we can convert an integer to an octal in Python. Python oct() Function SyntaxSyntax : oct(x) Parameters: x - Must be an integer number and can be in either binary, decimal 2 min read modf() function - Python modf() function is an inbuilt function in Python that returns the fractional and integer parts of the number in a two-item tuple. Both parts have the same sign as the number. The integer part is returned as a float. Example:Pythonimport math # modf() function used with a positive number print("math. 3 min read Python math function | copysign() math.copysign() is a function exists in Standard math Library of Python. This function returns a float value consisting of magnitude from parameter x and the sign (+ve or -ve) from parameter y. Syntax : math.copysign(x, y) Parameters : x : Integer value to be converted y : Integer whose sign is requ 1 min read Like