Author: manjula
Date: 2005-03-17 02:57:49 -0500 (Thu, 17 Mar 2005)
New Revision: 41927

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/ecore.cs
Log:
Rounding the double values before converting to Integer types


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-03-17 06:39:11 UTC (rev 41926)
+++ trunk/mcs/mbas/ChangeLog    2005-03-17 07:57:49 UTC (rev 41927)
@@ -1,4 +1,7 @@
 2005-03-17 Manjula GHM <[EMAIL PROTECTED]>
+       *ecore.cs : rounding the double values before converting to Integer 
types
+
+2005-03-17 Manjula GHM <[EMAIL PROTECTED]>
        *ecore.cs : Support Double in case statement and do necessary 
conversion to Int Literal
 
 2005-03-16 Manjula GHM <[EMAIL PROTECTED]>

Modified: trunk/mcs/mbas/ecore.cs
===================================================================
--- trunk/mcs/mbas/ecore.cs     2005-03-17 06:39:11 UTC (rev 41926)
+++ trunk/mcs/mbas/ecore.cs     2005-03-17 07:57:49 UTC (rev 41927)
@@ -3352,28 +3352,28 @@
 
                                 if (target_type == TypeManager.sbyte_type){
                                         if (v >= SByte.MinValue && v <= 
SByte.MaxValue)
-                                                return (sbyte) v;
+                                               return new SByteConstant 
((sbyte) System.Math.Round (v));
                                 } else if (target_type == 
TypeManager.byte_type){
                                         if (v >= Byte.MinValue && v <= 
Byte.MaxValue)
-                                                return (byte) v;
+                                               return new ByteConstant ((byte) 
System.Math.Round (v));
                                 } else if (target_type == 
TypeManager.char_type){
                                         if (v >= Char.MinValue && v <= 
Char.MaxValue)
-                                                return (char) v;
+                                               return (char) v;
                                 } else if (target_type == 
TypeManager.short_type){
                                         if (v >= Int16.MinValue && v <= 
Int16.MaxValue)
-                                                return (short) v;
+                                               return new ShortConstant 
((short) System.Math.Round (v));
                                 } else if (target_type == 
TypeManager.ushort_type){
                                         if (v >= UInt16.MinValue && v <= 
UInt16.MaxValue)
-                                                return (ushort) v;
+                                                return new UShortConstant 
((ushort) System.Math.Round (v));
                                } else if (target_type == 
TypeManager.int32_type){
                                         if (v >= Int32.MinValue && v <= 
Int32.MaxValue)
-                                                return (int) v;
+                                               return new IntConstant ((int) 
System.Math.Round (v));
                                 } else if (target_type == 
TypeManager.uint32_type){
                                         if (v >= 0 && v <= UInt32.MaxValue)
-                                                return (uint) v;
+                                               return new UIntConstant ((uint) 
System.Math.Round (v));
                                 } else if (target_type == 
TypeManager.uint64_type){
                                         if (v > 0)
-                                                return (ulong) v;
+                                               return new ULongConstant 
((ulong) System.Math.Round (v));
                                 }
                                 s = v.ToString ();
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to