[Mono-bugs] [Bug 43018][Nor] New - Mono is unable to evaluate Math.Pow (-2, (+/-)1E300))

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 14 May 2003 18:18:21 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=43018

--- shadow/43018	Wed May 14 18:18:21 2003
+++ shadow/43018.tmp.31407	Wed May 14 18:18:21 2003
@@ -0,0 +1,57 @@
+Bug#: 43018
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono is unable to evaluate Math.Pow (-2, (+/-)1E300))
+
+Description of Problem:
+The Math.Pow function gives NaN for Math.Pow (-2, (+/-)1E300)). It should
+give Infinity for the + case and 0 for the minus case.
+
+Steps to reproduce the problem:
+using System;
+
+class PowTest {
+	
+	static void Main () {
+		PowerTest (-2, 1E300, Double.PositiveInfinity);
+		PowerTest (-2, -1E300, 0);
+	}
+	
+	static void PowerTest (double b/*ase*/, double exponent, double expected) {
+		double actual = Math.Pow (b, exponent);
+		      
+		if (expected == actual)
+			return;
+		if (Double.IsNaN(expected) && Double.IsNaN(actual))
+			return;
+		if (Math.Abs (expected - actual) < Double.Epsilon)
+			return;
+		Console.WriteLine ("Math.Pow ({0}, {1}) Expected: {2} Got {3}", b,
+exponent, expected, actual);
+	}
+}
+Actual Results:
+Math.Pow (-2, 1.E+300) Expected: Infinity Got NaN
+Math.Pow (-2, -1.E+300) Expected: 0 Got NaN
+
+Expected Results:
+(program should run with no output)
+
+How often does this happen? 
+Always
+
+Additional Information:
+Mint does not suffer from this bug. Also, NUnit tests should be added for this.