[math] Fix corlib/System.MathTest.TestPow #47 on Linux 32bits
[mono.git] / mono / metadata / sysmath.c
index 45dc2ea04c4eec15ff861fa03b9e3e11777fbd62..a51da997aa1b86eb3a88e548371d78d95ad81686 100644 (file)
@@ -267,6 +267,10 @@ ves_icall_System_Math_Pow (gdouble x, gdouble y)
        /* On Linux 32bits, Math.Pow (-1, Double.MaxValue) would return NaN instead of 1 */
        if (isnan (result) && isminusone (x) && (y > 9007199254740991.0 || y < -9007199254740991.0))
                result = POne.d;
+
+       /* On Linux 32bits, Math.Pow (Double.MinValue, Double.MinValue) would return NaN instead of 0 */
+       if (isnan (result) && x < -9007199254740991.0 && y < -9007199254740991.0)
+               result = 0.0;
 #endif
 
        return result == -0.0 ? 0 : result;