Math Functions

math.ulp()

Measure the unit in the last place of a float, including the smallest positive subnormal at zero. Spacing depends on magnitude.

Formal Syntax & Structure

python syntaxpython
math.ulp(x, /)

Parameters & Attributes

NameTypeDescription
xreal numberInput real value.

Return Value

float

Floating-point result; finite precision and domain restrictions apply.

Working Example

Example Snippetpython
import mathprint(math.ulp(1.0))
Python Reference