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()); }
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())); }
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()); }
public void testSubtractNaN() { Complex x = new Complex(3.0, 4.0); Complex z = x.subtract(Complex.NaN); assertTrue(z.isNaN()); }
public void testNegateNaN() { Complex z = Complex.NaN.negate(); assertTrue(z.isNaN()); }
public void testScalarMultiplyNaN() { Complex x = new Complex(3.0, 4.0); Complex z = x.multiply(Double.NaN); assertTrue(z.isNaN()); }
public void testMultiplyNaN() { Complex x = new Complex(3.0, 4.0); Complex z = x.multiply(Complex.NaN); assertTrue(z.isNaN()); }
public void testDivideNaN() { Complex x = new Complex(3.0, 4.0); Complex z = x.divide(Complex.NaN); assertTrue(z.isNaN()); }
public void testConjugateNaN() { Complex z = Complex.NaN.conjugate(); assertTrue(z.isNaN()); }