*77*

# Java Math.ulp() method

The **java.lang.Math.ulp()** returns the size of an ulp of the argument. An ulp is the unit in the last place. An ulp of a float or double value is the positive distance between given value and the next value that is larger in magnitude.

#### Note: For non-NaN x, ulp(-x) == ulp(x).

## Syntax

## Parameter

## Return

- If the argument is positive or negative double or float value, this method will return the output.
- If the argument is positive or negative
**Infinity**, this method will return positive**Infinity**. - If the argument is positive or
**Negative Zero**, this method will return**Double.MIN_VALUE**. - If the argument is
**Â±Double.MAX_VALUE**, this method will return the result equal to**2**.^{971} - If the argument is
**Â±Float.MAX_VALUE**, this method will return the result equal to**2**.^{104} - If the argument is
**NaN**, this method will return**NaN**.

## Example 1

**Output:**

1.7763568394002505E-15

## Example 2

**Output:**

7.105427357601002E-15

## Example 3

**Output:**

Infinity

## Example 4

**Output:**

4.9E-324

## Example 5

**Output:**

1.9958403095347198E292

## Example 6

**Output:**

2.028241E31

Next TopicJava Math