Fixed Complex.reciprocal() for zero argument.

JIRA: MATH-934

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1459927 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2013-03-22 18:55:58 +00:00
parent 8c2199df0f
commit 724795b551
3 changed files with 5 additions and 2 deletions

View File

@ -55,6 +55,9 @@ This is a minor release: It combines bug fixes and new features.
Changes to existing features were made in a backwards-compatible Changes to existing features were made in a backwards-compatible
way such as to allow drop-in replacement of the v3.1[.1] JAR file. way such as to allow drop-in replacement of the v3.1[.1] JAR file.
"> ">
<action dev="luc" type="fix" issue="MATH-934">
Fixed Complex.reciprocal() for zero argument.
</action>
<action dev="luc" type="update" issue="MATH-951" due-to="Charles Cooper"> <action dev="luc" type="update" issue="MATH-951" due-to="Charles Cooper">
Improved speed of FastMath copysign methods. Improved speed of FastMath copysign methods.
</action> </action>

View File

@ -302,7 +302,7 @@ public class Complex implements FieldElement<Complex>, Serializable {
} }
if (real == 0.0 && imaginary == 0.0) { if (real == 0.0 && imaginary == 0.0) {
return NaN; return INF;
} }
if (isInfinite) { if (isInfinite) {

View File

@ -331,7 +331,7 @@ public class ComplexTest {
@Test @Test
public void testReciprocalZero() { public void testReciprocalZero() {
Assert.assertEquals(Complex.ZERO.reciprocal(), Complex.NaN); Assert.assertEquals(Complex.ZERO.reciprocal(), Complex.INF);
} }
@Test @Test