ulp

fun ulp(f: Float): Float

Returns the size of an ulp of the argument. An ulp, unit in the last place, of a float value is the positive distance between this floating-point value and the float value next larger in magnitude. Note that for non-NaN x, ulp(-*x*) == ulp(*x*).

Special Cases:

  • If the argument is NaN, then the result is NaN.

  • If the argument is positive or negative infinity, then the result is positive infinity.

  • If the argument is positive or negative zero, then the result is Float.MIN_VALUE.

  • If the argument is Float.MAX_VALUE, then the result is equal to 2104.

Return

the size of an ulp of the argument

Author

Joseph D. Darcy

Since

1.5

Parameters

f

the floating-point value whose ulp is to be returned