示例#1
0
  public void testConstructorNaN() {
    Complex z = new Complex(3.0, Double.NaN);
    assertTrue(z.isNaN());

    z = new Complex(nan, 4.0);
    assertTrue(z.isNaN());

    z = new Complex(3.0, 4.0);
    assertFalse(z.isNaN());
  }
示例#2
0
 public void testAddNaN() {
   Complex x = new Complex(3.0, 4.0);
   Complex z = x.add(Complex.NaN);
   assertTrue(z.isNaN());
   z = new Complex(1, nan);
   Complex w = x.add(z);
   assertEquals(w.getReal(), 4.0, 0);
   assertTrue(Double.isNaN(w.getImaginary()));
 }
示例#3
0
 public void testSerial() {
   Complex z = new Complex(3.0, 4.0);
   assertEquals(z, TestUtils.serializeAndRecover(z));
   Complex ncmplx = (Complex) TestUtils.serializeAndRecover(oneNaN);
   assertEquals(nanZero, ncmplx);
   assertTrue(ncmplx.isNaN());
   Complex infcmplx = (Complex) TestUtils.serializeAndRecover(infInf);
   assertEquals(infInf, infcmplx);
   assertTrue(infcmplx.isInfinite());
   TestComplex tz = new TestComplex(3.0, 4.0);
   assertEquals(tz, TestUtils.serializeAndRecover(tz));
   TestComplex ntcmplx = (TestComplex) TestUtils.serializeAndRecover(new TestComplex(oneNaN));
   assertEquals(nanZero, ntcmplx);
   assertTrue(ntcmplx.isNaN());
   TestComplex inftcmplx = (TestComplex) TestUtils.serializeAndRecover(new TestComplex(infInf));
   assertEquals(infInf, inftcmplx);
   assertTrue(inftcmplx.isInfinite());
 }
示例#4
0
 public void testSubtractNaN() {
   Complex x = new Complex(3.0, 4.0);
   Complex z = x.subtract(Complex.NaN);
   assertTrue(z.isNaN());
 }
示例#5
0
 public void testNegateNaN() {
   Complex z = Complex.NaN.negate();
   assertTrue(z.isNaN());
 }
示例#6
0
 public void testScalarMultiplyNaN() {
   Complex x = new Complex(3.0, 4.0);
   Complex z = x.multiply(Double.NaN);
   assertTrue(z.isNaN());
 }
示例#7
0
 public void testMultiplyNaN() {
   Complex x = new Complex(3.0, 4.0);
   Complex z = x.multiply(Complex.NaN);
   assertTrue(z.isNaN());
 }
示例#8
0
 public void testDivideNaN() {
   Complex x = new Complex(3.0, 4.0);
   Complex z = x.divide(Complex.NaN);
   assertTrue(z.isNaN());
 }
示例#9
0
 public void testConjugateNaN() {
   Complex z = Complex.NaN.conjugate();
   assertTrue(z.isNaN());
 }