Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Urban <lewurm@gmail.com>2018-09-22 00:43:43 +0300
committerBernhard Urban <lewurm@gmail.com>2018-10-05 12:04:06 +0300
commit2c48c62e66f535f8482923f73d32c8c7f6ac6035 (patch)
tree3f2c7ae25e10b0e2497deae8267a3a9342ec4174
parent5c5a48b144959299929bc83fa211497407aafcc1 (diff)
[interp] support nfloat.*Infinity
-rw-r--r--mono/mini/builtin-types.cs86
-rw-r--r--mono/mini/interp/transform.c2
2 files changed, 86 insertions, 2 deletions
diff --git a/mono/mini/builtin-types.cs b/mono/mini/builtin-types.cs
index adf737e4f26..3d5c6fff68c 100644
--- a/mono/mini/builtin-types.cs
+++ b/mono/mini/builtin-types.cs
@@ -1025,10 +1025,94 @@ public class BuiltinTests {
return 0;
}
+ static int test_0_nfloat_isinfinity ()
+ {
+ var x = (nfloat) float.NaN;
+ if (nfloat.IsInfinity (x))
+ return 1;
+ if (nfloat.IsInfinity (12))
+ return 2;
+ if (!nfloat.IsInfinity (nfloat.PositiveInfinity))
+ return 3;
+ if (!nfloat.IsInfinity (nfloat.NegativeInfinity))
+ return 4;
+
+ return 0;
+ }
+
+ static int test_0_nfloat_isnegativeinfinity ()
+ {
+ var x = (nfloat) float.NaN;
+ if (nfloat.IsNegativeInfinity (x))
+ return 1;
+ if (nfloat.IsNegativeInfinity (12))
+ return 2;
+ if (nfloat.IsNegativeInfinity (nfloat.PositiveInfinity))
+ return 3;
+ if (!nfloat.IsNegativeInfinity (nfloat.NegativeInfinity))
+ return 4;
+
+ float f = float.NegativeInfinity;
+ nfloat n = (nfloat) f;
+ if (!nfloat.IsNegativeInfinity (n))
+ return 5;
+
+ double d = double.NegativeInfinity;
+ n = (nfloat) d;
+ if (!nfloat.IsNegativeInfinity (n))
+ return 6;
+
+ return 0;
+ }
+
+ static int test_0_nfloat_ispositiveinfinity ()
+ {
+ var x = (nfloat) float.NaN;
+ if (nfloat.IsPositiveInfinity (x))
+ return 1;
+ if (nfloat.IsPositiveInfinity (12))
+ return 2;
+ if (!nfloat.IsPositiveInfinity (nfloat.PositiveInfinity))
+ return 3;
+ if (nfloat.IsPositiveInfinity (nfloat.NegativeInfinity))
+ return 4;
+
+ float f = float.PositiveInfinity;
+ nfloat n = (nfloat) f;
+ if (!nfloat.IsPositiveInfinity (n))
+ return 5;
+
+ double d = double.PositiveInfinity;
+ n = (nfloat) d;
+ if (!nfloat.IsPositiveInfinity (n))
+ return 6;
+
+ return 0;
+ }
+
static int test_0_nfloat_isnan ()
{
var x = (nfloat) float.NaN;
- return nfloat.IsNaN (x) ? 0 : 1;
+ if (!nfloat.IsNaN (x))
+ return 1;
+ if (nfloat.IsNaN (12))
+ return 2;
+ if (nfloat.IsNaN (nfloat.PositiveInfinity))
+ return 3;
+ if (nfloat.IsNaN (nfloat.NegativeInfinity))
+ return 4;
+
+ float f = float.NaN;
+ nfloat n = (nfloat) f;
+ if (!nfloat.IsNaN (n))
+ return 5;
+
+ double d = double.NaN;
+ n = (nfloat) d;
+ if (!nfloat.IsNaN (n))
+ return 6;
+
+ return 0;
}
static int test_0_nfloat_compareto ()
diff --git a/mono/mini/interp/transform.c b/mono/mini/interp/transform.c
index 6b9821efbf6..964bfb67826 100644
--- a/mono/mini/interp/transform.c
+++ b/mono/mini/interp/transform.c
@@ -1067,7 +1067,7 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoMeth
} else if (!strcmp ("Parse", tm)) {
/* white list */
return FALSE;
- } else if (!strcmp ("IsNaN", tm)) {
+ } else if (!strcmp ("IsNaN", tm) || !strcmp ("IsInfinity", tm) || !strcmp ("IsNegativeInfinity", tm) || !strcmp ("IsPositiveInfinity", tm)) {
g_assert (type_index == 2); // nfloat only
/* white list */
return FALSE;