Inline-only in kotlin and kotlin.system packages, split Float/Double extension implementations for JVM and JS to make them inline-only in JVM.

This commit is contained in:
Ilya Gorbunov
2016-01-28 21:45:46 +03:00
parent 40fae0463f
commit 56c5758db1
10 changed files with 103 additions and 38 deletions
+33
View File
@@ -0,0 +1,33 @@
package kotlin
/**
* Returns `true` if the specified number is a
* Not-a-Number (NaN) value, `false` otherwise.
*/
public fun Double.isNaN(): Boolean = this != this
/**
* Returns `true` if the specified number is a
* Not-a-Number (NaN) value, `false` otherwise.
*/
public fun Float.isNaN(): Boolean = this != this
/**
* Returns `true` if this value is infinitely large in magnitude.
*/
public fun Double.isInfinite(): Boolean = this == Double.POSITIVE_INFINITY || this == Double.NEGATIVE_INFINITY
/**
* Returns `true` if this value is infinitely large in magnitude.
*/
public fun Float.isInfinite(): Boolean = this == Float.POSITIVE_INFINITY || this == Float.NEGATIVE_INFINITY
/**
* Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).
*/
public fun Double.isFinite(): Boolean = !isInfinite() && !isNaN()
/**
* Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).
*/
public fun Float.isFinite(): Boolean = !isInfinite() && !isNaN()