[Mono-list] Patches for Math.cs

yoros@wanadoo.es yoros@wanadoo.es
Sat, 1 Feb 2003 18:36:05 +0100


--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit


Hi,

I send a patch to the following files:

	mcs/class/corlib/System/Math.cs
	mono/mono/metadata/icall.c
	mono/mono/metadata/sysmath.h
	mono/mono/metadata/sysmath.c

They are all changes related to the class System.Math. I don't have any
testcase because the only way to do that is comparing the output of all
the functions with the output of the MS.NET Math functions... It can't
be done now because of ToString methods (that are not fully finished).

See you,

    Pedro

-- 
Pedro Martinez Juliá
\  yoros@terra.es
)|    yoros@wanadoo.es
/        http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename="Math.cs.patch"
Content-Transfer-Encoding: 8bit

Index: Math.cs
===================================================================
RCS file: /mono/mcs/class/corlib/System/Math.cs,v
retrieving revision 1.15
diff -u -p -r1.15 Math.cs
--- Math.cs	24 Jan 2003 16:10:01 -0000	1.15
+++ Math.cs	1 Feb 2003 17:22:55 -0000
@@ -4,353 +4,394 @@
 // Author:
 //   Bob Smith (bob@thestuff.net)
 //   Dan Lewis (dihlewis@yahoo.co.uk)
+//   Pedro Martínez Juliá (yoros@wanadoo.es)
 //
 // (C) 2001 Bob Smith.  http://www.thestuff.net
+// Copyright (C) 2003 Pedro Martínez Juliá <yoros@wanadoo.es>
 //
 
 using System;
 using System.Globalization;
 using System.Runtime.CompilerServices;
 
-namespace System
-{
-//	[CLSCompliant(false)]
-        public sealed class Math
-        {
-                public const double E = 2.7182818284590452354;
-                public const double PI = 3.14159265358979323846;
-
-		private Math () {}
-
-                public static decimal Abs(decimal value)
-                {
-                        return (value < 0)? -value: value;
-                }
-                public static double Abs(double value)
-                {
-                        return (value < 0)? -value: value;
-                }
-                public static float Abs(float value)
-                {
-                        return (value < 0)? -value: value;
-                }
-                public static int Abs(int value)
-                {
-                        if (value == Int32.MinValue)
-                                throw new OverflowException (Locale.GetText (Locale.GetText ("Value is too small")));
-                        return (value < 0)? -value: value;
-                }
-                public static long Abs(long value)
-                {
-                        if (value == Int64.MinValue)
-                                throw new OverflowException(Locale.GetText ("Value is too small"));
-                        return (value < 0)? -value: value;
-                }
+namespace System {
+
+	public sealed class Math {
+
+		public const double E = 2.7182818284590452354;
+		public const double PI = 3.14159265358979323846;
+
+		public static decimal Abs (decimal value) {
+			return (value < 0)? -value: value;
+		}
+
+		public static double Abs (double value) {
+			return (value < 0)? -value: value;
+		}
+
+		public static float Abs (float value) {
+			return (value < 0)? -value: value;
+		}
+
+		public static int Abs (int value) {
+			if (value == Int32.MinValue)
+				throw new OverflowException (
+					Locale.GetText("Value is too small"));
+			return (value < 0)? -value: value;
+		}
+
+		public static long Abs (long value) {
+			if (value == Int64.MinValue)
+				throw new OverflowException (
+					Locale.GetText ("Value is too small"));
+			return (value < 0)? -value: value;
+		}
+
 		[CLSCompliant (false)]
-                public static sbyte Abs(sbyte value)
-                {
-                        if (value == SByte.MinValue)
-                                throw new OverflowException(Locale.GetText ("Value is too small"));
-                        return (sbyte)((value < 0)? -value: value);
-                }
-                public static short Abs(short value)
-                {
-                        if (value == Int16.MinValue)
-                                throw new OverflowException(Locale.GetText ("Value is too small"));
-                        return (short)((value < 0)? -value: value);
-                }
-
-                public static double Ceiling(double a)
-                {
-			if (Double.IsNaN(a)){
+		public static sbyte Abs (sbyte value) {
+			if (value == SByte.MinValue)
+				throw new OverflowException (
+					Locale.GetText ("Value is too small"));
+			return (sbyte) ((value < 0)? -value: value);
+		}
+
+		public static short Abs (short value) {
+			if (value == Int16.MinValue)
+				throw new OverflowException (
+					Locale.GetText ("Value is too small"));
+			return (short) ((value < 0)? -value: value);
+		}
+
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Acos (double x);
+		
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Asin (double x);
+
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Atan (double x);
+
+		public static double Atan2 (double x, double y) {
+			if (Double.IsInfinity(x) && Double.IsInfinity(y)) {
 				return Double.NaN;
 			}
-
-			if (Double.IsNegativeInfinity(a)){
-				return Double.NegativeInfinity;
+			double result = InternalAtan2(x,y);
+			return (result == -0)? 0: result;
+		}
+
+		public static double Ceiling (double value) {
+			if (Double.IsNaN(value) ||
+				Double.IsNegativeInfinity(value) ||
+				Double.IsPositiveInfinity(value)) {
+				return value;
+			}
+			double result = InternalFloor(value);
+			if (result != value) {
+				result++;
 			}
+			return result;
+		}
 
-			if (Double.IsPositiveInfinity(a)){
-				return Double.PositiveInfinity;
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Cos (double x);
+
+
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Cosh (double x);
+
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Exp (double x);
+
+		public static double Floor (double value) {
+			if (Double.IsNaN(value) ||
+				Double.IsNegativeInfinity(value) ||
+				Double.IsPositiveInfinity(value)) {
+				return value;
 			}
+			return InternalFloor(value);
+		}
 
-			double b = (double)((long)a);
-                        return (b < a)? b+1: b;
-                }
-                public static double Floor(double d) {
-			if (Double.IsNaN(d)){
+		public static double IEEERemainder (double x, double y) {
+			if (y == 0)
 				return Double.NaN;
-			}
+			double r = x - (y * Math.Round(x/y));
+			if (r != 0)
+				return r;
+			return (x > 0)? 0: -0;
+		}
 
-			if (Double.IsNegativeInfinity(d)){
-				return Double.NegativeInfinity;
-			}
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Log (double x);
 
-			if (Double.IsPositiveInfinity(d)){
+		public static double Log (double a, double newBase) {
+			if (a == 0)
 				return Double.PositiveInfinity;
+			if (a < 0)
+				return Double.NaN;
+			if (Double.IsPositiveInfinity(a) &&
+				!Double.IsInfinity(newBase) &&
+				!Double.IsNaN(newBase)) {
+				return Double.PositiveInfinity;
+			}
+			if (Double.IsPositiveInfinity(newBase) &&
+				!Double.IsInfinity(a) &&
+				!Double.IsNaN(a)) {
+				return 0.0;
 			}
+			if ((Double.IsPositiveInfinity(a) &&
+				Double.IsPositiveInfinity(newBase)) ||
+				Double.IsNaN(a) || Double.IsNegativeInfinity(a) ||
+				Double.IsNaN(newBase) || Double.IsNegativeInfinity(newBase)) {
+				return Double.NaN;
+			}
+			double result = Log(a)/Log(newBase);
+			return (result == -0)? 0: result;
+		}
 
-			double b = (double)((long)d);
-			return (d < 0 && d != b) ? --b : b;
-                }
-                public static double IEEERemainder(double x, double y)
-                {
-                        double r;
-                        if (y == 0) return Double.NaN;
-                        r = x - (y * Math.Round(x/y));
-                        if (r != 0) return r;
-                        return (x > 0)? 0: -0;
-                }
-                public static double Log(double a, double newBase)
-                {
-                        if (a == 0) return Double.NegativeInfinity;
-                        else if (a < 0) return Double.NaN;
-                        return Log(a)/Log(newBase);
-                }
-
-                public static byte Max(byte val1, byte val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static decimal Max(decimal val1, decimal val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static double Max(double val1, double val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static float Max(float val1, float val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static int Max(int val1, int val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static long Max(long val1, long val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		public extern static double Log10 (double x);
 
-		[CLSCompliant (false)]
-                public static sbyte Max(sbyte val1, sbyte val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static short Max(short val1, short val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
+		public static byte Max (byte val1, byte val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static decimal Max (decimal val1, decimal val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static double Max (double val1, double val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static short Max (short val1, short val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static int Max (int val1, int val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static long Max (long val1, long val2) {
+			return (val1 > val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static uint Max(uint val1, uint val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
+		public static sbyte Max (sbyte val1, sbyte val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static float Max (float val1, float val2) {
+			return (val1 > val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static ulong Max(ulong val1, ulong val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
+		public static ushort Max (ushort val1, ushort val2) {
+			return (val1 > val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static ushort Max(ushort val1, ushort val2)
-                {
-                        return (val1 > val2)? val1: val2;
-                }
-                public static byte Min(byte val1, byte val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-                public static decimal Min(decimal val1, decimal val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-                public static double Min(double val1, double val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-                public static float Min(float val1, float val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-                public static int Min(int val1, int val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-                public static long Min(long val1, long val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
+		public static uint Max (uint val1, uint val2) {
+			return (val1 > val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static sbyte Min(sbyte val1, sbyte val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-                public static short Min(short val1, short val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
+		public static ulong Max (ulong val1, ulong val2) {
+			return (val1 > val2)? val1: val2;
+		}
+
+		public static byte Min (byte val1, byte val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static decimal Min (decimal val1, decimal val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static double Min (double val1, double val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static short Min (short val1, short val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static int Min (int val1, int val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static long Min (long val1, long val2) {
+			return (val1 < val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static uint Min(uint val1, uint val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
+		public static sbyte Min (sbyte val1, sbyte val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static float Min (float val1, float val2) {
+			return (val1 < val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static ulong Min(ulong val1, ulong val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
+		public static ushort Min (ushort val1, ushort val2) {
+			return (val1 < val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static ushort Min(ushort val1, ushort val2)
-                {
-                        return (val1 < val2)? val1: val2;
-                }
-
-                public static decimal Round(decimal d)
-                {
-                        decimal r = (decimal)((long)d);
-                        decimal a = Abs (d - r);
-                        if (a > .5M) return (r >= 0 ? ++r : --r);
-                        else if (a <.5M) return r;
-                        else
-                        {
-                                if (r%2 == 0) return r;
-                                else return ++r;
-                        }
-                }
-                public static decimal Round(decimal d, int decimals)
-                {
-                        long p = 1;
-                        int c;
-                        decimal retval = d;
-                        if (decimals < 0 || decimals > 15)
-                                throw new ArgumentOutOfRangeException(Locale.GetText (
-					"Value is too small or too big."));
-                        else if (decimals == 0)
-                                return Math.Round(d);
-                        for (c=0; c<decimals; c++) p*=10;
-                        retval*=p;
-                        retval=Math.Round(retval);
-                        retval/=p;
-                        return retval;
-                }
-                public static double Round(double d)
-                {
-                        double r = (double)((long)d);
-                        double a = Abs (d - r);
-                        if (a > .5) return (r >= 0 ? ++r : --r);
-                        else if (a <.5) return r;
-                        else
-                        {
-                                if (r%2 == 0) return r;
-                                else return ++r;
-                        }
-                }
-                public static double Round(double value, int digits) {
-                        long p = 1;
-                        int c;
-                        double retval = value;
-                        if (digits < 0 || digits > 15)
-                                throw new ArgumentOutOfRangeException(Locale.GetText (
-					"Value is too small or too big."));
-                        else if (digits == 0)
-                                return Math.Round(value);
-                        for (c=0; c<digits; c++) p*=10;
-                        retval*=p;
-                        retval=Math.Round(retval);
-                        retval/=p;
-                        return retval;
-                }
-                public static int Sign(decimal value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
-                public static int Sign(double value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
-                public static int Sign(float value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
-                public static int Sign(int value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
-                public static int Sign(long value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
+		public static uint Min (uint val1, uint val2) {
+			return (val1 < val2)? val1: val2;
+		}
 
 		[CLSCompliant (false)]
-                public static int Sign(sbyte value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
-                public static int Sign(short value)
-                {
-                        if (value > 0) return 1;
-                        return (value == 0)? 0: -1;
-                }
+		public static ulong Min (ulong val1, ulong val2) {
+			return (val1 < val2)? val1: val2;
+		}
+
+		public static double Pow (double x, double y) {
+			if (Double.IsNaN(x) || Double.IsNaN(y))
+				return Double.NaN;
+			if (Double.IsNegativeInfinity(x)) {
+				if (IEEERemainder(y, 2.0) == 0)
+					return Double.NegativeInfinity;
+				else
+					return Double.PositiveInfinity;
+			}
+			if (Double.IsNegativeInfinity(y))
+				return 0.0;
+			if (Double.IsPositiveInfinity(x)) {
+				if (Double.IsNegativeInfinity(y))
+					return 0;
+				else
+					return Double.PositiveInfinity;
+			}
+			if (Double.IsPositiveInfinity(y)) {
+				return Double.PositiveInfinity;
+			}
+			double result = InternalPow(x,y);
+			return (result == -0)? 0: result;
+		}
+
+		public static decimal Round (decimal value) {
+			decimal result = value;
+			DecimalRound(ref result, 0);
+			return result;
+		}
+
+		public static double Round (double value) {
+			return InternalRound(value);
+		}
+
+		public static decimal Round (decimal value, int decimals) {
+			if (decimals < 0 || decimals > 28) 
+				throw new ArgumentOutOfRangeException(
+					"Second argument must be betwen 0 and 28.");
+			decimal result = value;
+			DecimalRound(ref result, decimals);
+			return result;
+		}
+
+		public static double Round(double value, int decimals) {
+			double integral_part = InternalRound(value);
+			if (decimals < 0 || decimals > 15) 
+				throw new ArgumentOutOfRangeException(
+					"Second argument must be betwen 0 and 15.");
+			if (decimals == 0)
+				return integral_part;
+			double decimal_part = value - integral_part;
+			decimal_part *= InternalPow(10, decimals);
+			decimal_part = InternalRound(decimal_part);
+			decimal_part /= InternalPow(10, decimals);
+			return integral_part + decimal_part;
+		}
+
+		public static int Sign (decimal value) {
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
+
+		public static int Sign (double value) {
+			if (Double.IsNaN(value))
+				throw new ArithmeticException("NAN");
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
+
+		public static int Sign (short value) {
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
+
+		public static int Sign (int value) {
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
+
+		public static int Sign (long value) {
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
 
-		// internal calls 
+		[CLSCompliant (false)]
+		public static int Sign (sbyte value) {
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
 
-		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Sin (double x);
+		public static int Sign (float value) {
+			if (Single.IsNaN(value))
+				throw new ArithmeticException("NAN");
+			if (value > 0)
+				return 1;
+			return (value == 0)? 0: -1;
+		}
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Cos (double x);
+		public extern static double Sin (double x);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Tan (double x);
+		public extern static double Sinh (double x);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Sinh (double x);
+		public extern static double Sqrt (double x);
 
-		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Cosh (double x);
+		public static double Tan (double value) {
+			if (Double.IsNaN(value) ||
+				value == Double.MaxValue ||
+				value == Double.MinValue) {
+				return Double.NaN;
+			}
+			return InternalTan(value);
+		}
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Tanh (double x);
+		public extern static double Tanh (double x);
 
-		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Acos (double x);
-		
-		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Asin (double x);
+		// private internal calls
 
-		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Atan (double x);
+		[MethodImplAttribute(MethodImplOptions.InternalCall)]
+		private static extern void DecimalRound(ref Decimal val, int decimals);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Atan2 (double y, double x);
+		private extern static double InternalFloor (double value);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Exp (double x);
+		private extern static double InternalRound (double value);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Log (double x);
+		private extern static double InternalTan (double value);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Log10 (double x);
+		private extern static double InternalAtan2 (double x, double y);
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Pow (double x, double y);
+		private extern static double InternalPow (double x, double y);
 
-		[MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Sqrt (double x);
         }
+
 }

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="icall.c.patch"

Index: icall.c
===================================================================
RCS file: /mono/mono/mono/metadata/icall.c,v
retrieving revision 1.256
diff -u -p -r1.256 icall.c
--- icall.c	31 Jan 2003 18:38:14 -0000	1.256
+++ icall.c	1 Feb 2003 17:23:48 -0000
@@ -3554,19 +3554,22 @@ static gconstpointer icall_map [] = {
 	 */
 	"System.Math::Sin", ves_icall_System_Math_Sin,
         "System.Math::Cos", ves_icall_System_Math_Cos,
-        "System.Math::Tan", ves_icall_System_Math_Tan,
         "System.Math::Sinh", ves_icall_System_Math_Sinh,
         "System.Math::Cosh", ves_icall_System_Math_Cosh,
         "System.Math::Tanh", ves_icall_System_Math_Tanh,
         "System.Math::Acos", ves_icall_System_Math_Acos,
         "System.Math::Asin", ves_icall_System_Math_Asin,
         "System.Math::Atan", ves_icall_System_Math_Atan,
-        "System.Math::Atan2", ves_icall_System_Math_Atan2,
         "System.Math::Exp", ves_icall_System_Math_Exp,
         "System.Math::Log", ves_icall_System_Math_Log,
         "System.Math::Log10", ves_icall_System_Math_Log10,
-        "System.Math::Pow", ves_icall_System_Math_Pow,
         "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
+	"System.Math::DecimalRound", mono_decimalRound,
+	"System.Math::InternalFloor", ves_icall_System_Math_Floor,
+	"System.Math::InternalRound", ves_icall_System_Math_Round,
+	"System.Math::InternalTan", ves_icall_System_Math_Tan,
+	"System.Math::InternalAtan2", ves_icall_System_Math_Atan2,
+	"System.Math::InternalPow", ves_icall_System_Math_Pow,
 
 	/*
 	 * System.Environment

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sysmath.h.patch"

Index: sysmath.h
===================================================================
RCS file: /mono/mono/mono/metadata/sysmath.h,v
retrieving revision 1.1
diff -u -p -r1.1 sysmath.h
--- sysmath.h	18 Mar 2002 16:49:45 -0000	1.1
+++ sysmath.h	1 Feb 2003 17:24:10 -0000
@@ -13,6 +13,9 @@
 #include <config.h>
 #include <glib.h>
 
+extern gdouble ves_icall_System_Math_Floor (gdouble x);
+extern gdouble ves_icall_System_Math_Round (gdouble x);
+
 extern gdouble 
 ves_icall_System_Math_Sin (gdouble x);
 

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sysmath.c.patch"

Index: sysmath.c
===================================================================
RCS file: /mono/mono/mono/metadata/sysmath.c,v
retrieving revision 1.7
diff -u -p -r1.7 sysmath.c
--- sysmath.c	28 Nov 2002 10:02:07 -0000	1.7
+++ sysmath.c	1 Feb 2003 17:24:17 -0000
@@ -29,6 +29,16 @@ static __huge_val_t __huge_val = { __HUG
 #  define HUGE_VAL      (__huge_val.__d)
 #endif
 
+gdouble ves_icall_System_Math_Floor (gdouble x) {
+	MONO_ARCH_SAVE_REGS;
+	return floor(x);
+}
+
+gdouble ves_icall_System_Math_Round (gdouble x) {
+	MONO_ARCH_SAVE_REGS;
+	return round(x);
+}
+
 gdouble 
 ves_icall_System_Math_Sin (gdouble x)
 {

--qDbXVdCdHGoSgWSk--