byte b = (byte)a;
if (b != 2)
return 5;
+ sbyte sb = (sbyte)a;
+ if (sb != 2)
+ return 6;
return 0;
}
return (int)f;
}
+ static int test_5_double_conv_r4 () {
+ double d = 5.0;
+ float f = (float)d;
+ return (int)f;
+ }
+
+ static int test_5_float_conv_r8 () {
+ float f = 5.0F;
+ double d = (double)f;
+ return (int)d;
+ }
+
static int test_5_conv_r8 () {
int i = 5;
double f = (double)i;
return (int)(1.0 + (a + (b + (c + (d + (e + (f + (g + (h + i)))))))));
}
+ static int test_4_float_sub_spill () {
+ // we overflow the FP stack
+ double a = 1;
+ double b = 2;
+ double c = 3;
+ double d = 4;
+ double e = 5;
+ double f = 6;
+ double g = 7;
+ double h = 8;
+ double i = 9;
+
+ return -(int)(1.0 - (a - (b - (c - (d - (e - (f - (g - (h - i)))))))));
+ ////// -(int)(1.0 - (1 - (2 - (3 - (4 - (5 - (6 - (7 - (8 - 9)))))))));
+ }
+
static int test_362880_float_mul_spill () {
// we overflow the FP stack
double a = 1;
long b = (long)d;
if (b != 1000)
return 0;
+ a = -1;
+ d = (double)a;
+ b = (long)d;
+ if (b != -1)
+ return 1;
+ return 4;
+ }
+
+ static int test_4_ulong_cast () {
+ ulong a = 1000;
+ double d = (double)a;
+ ulong b = (ulong)d;
+ if (b != 1000)
+ return 0;
+ return 4;
+ }
+
+ static int test_4_single_long_cast () {
+ long a = 1000;
+ float d = (float)a;
+ long b = (long)d;
+ if (b != 1000)
+ return 0;
+ a = -1;
+ d = (float)a;
+ b = (long)d;
+ if (b != -1)
+ return 1;
return 4;
}
+ public static int test_0_lconv_to_r8 () {
+ long a = 150;
+ double b = (double) a;
+
+ if (b != 150.0)
+ return 1;
+ return 0;
+ }
+
+ public static int test_0_lconv_to_r4 () {
+ long a = 3000;
+ float b = (float) a;
+
+ if (b != 3000.0F)
+ return 1;
+ return 0;
+ }
+
+ static void doit (double value, out long m) {
+ m = (long) value;
+ }
+
+ public static int test_0_ftol_clobber () {
+ long m;
+ doit (1.3, out m);
+ if (m != 1)
+ return 2;
+ return 0;
+ }
+
+ public static int test_0_rounding () {
+ long ticks = 631502475130080000L;
+ long ticksperday = 864000000000L;
+
+ double days = (double) ticks / ticksperday;
+
+ if ((int)days != 730905)
+ return 1;
+
+ return 0;
+ }
+
/* FIXME: This only works on little-endian machines */
/*
static unsafe int test_2_negative_zero () {
return result;
}
+ static int test_0_float_precision () {
+ float f1 = 3.40282346638528859E+38f;
+ float f2 = 3.40282346638528859E+38f;
+ float PositiveInfinity = 1.0f / 0.0f;
+ float f = f1 + f2;
+
+ return f == PositiveInfinity ? 0 : 1;
+ }
}