From b74c501fa6b5cf696bb4ccc23d9e6a17dd1d4d08 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 4 Sep 2018 17:27:54 +0300 Subject: [PATCH] Add Float/Double.isFinite --- .../src/main/java/org/teavm/classlib/java/lang/TDouble.java | 4 ++++ .../src/main/java/org/teavm/classlib/java/lang/TFloat.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java index acdc85d15..cdd076127 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java @@ -233,6 +233,10 @@ public class TDouble extends TNumber implements TComparable { @Import(module = "teavm", name = "isinf") 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) { return doubleToLongBits(value); } diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java index 4b2d23cc2..af2db912a 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java @@ -97,6 +97,10 @@ public class TFloat extends TNumber implements TComparable { @Import(module = "teavm", name = "isinf") 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;") @Import(module = "teavm", name = "TeaVM_getNaN") private static native float getNaN();