2008-08-29 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / mini / basic-float.cs
index 6dadc5aaef0141211a6f8557ee50e3a5d8468c09..5962b79b844ccb819b61becd7d5cacfc663367fb 100644 (file)
@@ -192,6 +192,59 @@ class Tests {
                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;
@@ -534,5 +587,13 @@ class Tests {
                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;
+       }
 }