IEEE754rUtils

public class org.apache.commons.lang3.math.IEEE754rUtils[source]

Provides IEEE-754r variants of NumberUtils methods.

See: https://en.wikipedia.org/wiki/IEEE_754r

Since:

2.4

Constructors

IEEE754rUtils()

Deprecated. Make private in 4.0.

@Deprecated public IEEE754rUtils()[source]

Deprecated: TODO Make private in 4.0.

Make private in 4.0.

Methods

max(double, double)

Gets the maximum of two double values.

max(double, double, double)

Gets the maximum of three double values.

max(double[])

Returns the maximum value in an array.

max(float, float)

Gets the maximum of two float values.

max(float, float, float)

Gets the maximum of three float values.

max(float[])

Returns the maximum value in an array.

min(double, double)

Gets the minimum of two double values.

min(double, double, double)

Gets the minimum of three double values.

min(double[])

Returns the minimum value in an array.

min(float, float)

Gets the minimum of two float values.

min(float, float, float)

Gets the minimum of three float values.

min(float[])

Returns the minimum value in an array.

public static double max(double a, double b)[source]

Gets the maximum of two double values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

Returns:

the largest of the values.

public static double max(double a, double b, double c)[source]

Gets the maximum of three double values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

  • c – value 3.

Returns:

the largest of the values.

public static double max(double... array)[source]

Returns the maximum value in an array.

Parameters:

array – An array, must not be null or empty.

Returns:

The maximum value in the array.

Throws:
  • java.lang.NullPointerException – Thrown if array is null.

  • java.lang.IllegalArgumentException – Thrown if array is empty.

Since:

3.4 Changed signature from max(double[]) to max(double…)

public static float max(float a, float b)[source]

Gets the maximum of two float values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

Returns:

the largest of the values.

public static float max(float a, float b, float c)[source]

Gets the maximum of three float values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

  • c – value 3.

Returns:

the largest of the values.

public static float max(float... array)[source]

Returns the maximum value in an array.

Parameters:

array – An array, must not be null or empty.

Returns:

The maximum value in the array.

Throws:
  • java.lang.NullPointerException – Thrown if array is null.

  • java.lang.IllegalArgumentException – Thrown if array is empty.

Since:

3.4 Changed signature from max(float[]) to max(float…)

public static double min(double a, double b)[source]

Gets the minimum of two double values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

Returns:

the smallest of the values.

public static double min(double a, double b, double c)[source]

Gets the minimum of three double values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1

  • b – value 2

  • c – value 3

Returns:

the smallest of the values

public static double min(double... array)[source]

Returns the minimum value in an array.

Parameters:

array – An array, must not be null or empty.

Returns:

The minimum value in the array.

Throws:
  • java.lang.NullPointerException – Thrown if array is null.

  • java.lang.IllegalArgumentException – Thrown if array is empty.

Since:

3.4 Changed signature from min(double[]) to min(double…).

public static float min(float a, float b)[source]

Gets the minimum of two float values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

Returns:

the smallest of the values.

public static float min(float a, float b, float c)[source]

Gets the minimum of three float values.

NaN is only returned if all numbers are NaN as per IEEE-754r.

Parameters:
  • a – value 1.

  • b – value 2.

  • c – value 3.

Returns:

the smallest of the values.

public static float min(float... array)[source]

Returns the minimum value in an array.

Parameters:

array – An array, must not be null or empty.

Returns:

The minimum value in the array.

Throws:
  • java.lang.NullPointerException – Thrown if array is null.

  • java.lang.IllegalArgumentException – Thrown if array is empty.

Since:

3.4 Changed signature from min(float[]) to min(float…).