doubleUlpEquals

fun doubleUlpEquals(x: Double, y: Double, maxUlps: Int): Boolean

Returns true if the arguments are equal or within the range of allowed error (inclusive). Returns false if either of the arguments is NaN.

Two double numbers are considered equal if there are (maxUlps - 1) (or fewer) floating point numbers between them, i.e. two adjacent floating point numbers are considered equal.

Adapted from org.apache.commons.numbers.core.Precision

github: https://github.com/apache/commons-numbers release 1.2

Return

true if there are fewer than maxUlps floating point values between x and y.

Parameters

x

first value

y

second value

maxUlps

(maxUlps - 1) is the number of floating point values between x and y.