2002-06-08 Martin Baulig <martin@gnome.org>
[mono.git] / mcs / class / corlib / System / Math.cs
index ef84da8959bfc6920b639c336eb5bf6fd42b102e..b38a67666790ae6e725de3f63b8d39977bbdc050 100644 (file)
@@ -347,8 +347,27 @@ namespace System
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                 public extern static double Log10 (double x);
 
+               public static double Pow (double x, double y) {
+                       if (Double.IsNaN (x) || Double.IsNaN (y))
+                               return Double.NaN;
+                       if (Double.IsNegativeInfinity (x))
+                               if (((int)y & 1) == 1)
+                                       return Double.NegativeInfinity;
+                               else
+                                       return Double.PositiveInfinity;
+                       if (Double.IsPositiveInfinity (x))
+                               if (Double.IsNegativeInfinity (y))
+                                       return 0;
+                               else
+                                       return Double.PositiveInfinity;
+                       if (Double.IsNegativeInfinity (y) || Double.IsPositiveInfinity (y))
+                               return Double.NaN;
+                       
+                       return PowImpl (x, y);
+               }
+
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-                public extern static double Pow (double x, double y);
+                public extern static double PowImpl (double x, double y);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                 public extern static double Sqrt (double x);