Implement in JS nextUp(), nextDown(), nextTowards() and ulp extensions

#KT-4900
This commit is contained in:
Ilya Gorbunov
2017-08-31 22:12:08 +03:00
parent 480d4a0093
commit aa3bfc55c3
6 changed files with 138 additions and 37 deletions
+2 -2
View File
@@ -555,14 +555,14 @@ public inline fun Double.withSign(sign: Double): Double = nativeMath.copySign(th
public inline fun Double.withSign(sign: Int): Double = nativeMath.copySign(this, sign.toDouble())
/**
* Returns the ulp of this value.
* Returns the ulp (unit in the last place) of this value.
*
* An ulp is a positive distance between this value and the next nearest [Double] value larger in magnitude.
*
* Special Cases:
* - `NaN.ulp` is `NaN`
* - `x.ulp` is `+Inf` when `x` is `+Inf` or `-Inf`
* - `0.0.ulp` is `Double.NIN_VALUE`
* - `0.0.ulp` is `Double.MIN_VALUE`
*/
@SinceKotlin("1.2")
@InlineOnly