Add Float/Double.isFinite

This commit is contained in:
Alexey Andreev 2018-09-04 17:27:54 +03:00
parent 8c35ef0189
commit b74c501fa6
2 changed files with 8 additions and 0 deletions

View File

@ -233,6 +233,10 @@ public class TDouble extends TNumber implements TComparable<TDouble> {
@Import(module = "teavm", name = "isinf") @Import(module = "teavm", name = "isinf")
public static native boolean isInfinite(double v); public static native boolean isInfinite(double v);
@JSBody(params = "v", script = "return isFinite(v);")
@Import(module = "teavm", name = "isfinite")
public static native boolean isFinite(double v);
public static long doubleToRawLongBits(double value) { public static long doubleToRawLongBits(double value) {
return doubleToLongBits(value); return doubleToLongBits(value);
} }

View File

@ -97,6 +97,10 @@ public class TFloat extends TNumber implements TComparable<TFloat> {
@Import(module = "teavm", name = "isinf") @Import(module = "teavm", name = "isinf")
public static native boolean isInfinite(float v); public static native boolean isInfinite(float v);
@JSBody(params = "v", script = "return isFinite(v);")
@Import(module = "teavm", name = "isfinite")
public static native boolean isFinite(float v);
@JSBody(script = "return NaN;") @JSBody(script = "return NaN;")
@Import(module = "teavm", name = "TeaVM_getNaN") @Import(module = "teavm", name = "TeaVM_getNaN")
private static native float getNaN(); private static native float getNaN();