Files
spring-boot-rest/apache-commons-math/src/test/java/com/baeldung/commons/math/ComplexTests.java
Alexandre Lombard 1aff8ca17d BAEL 767 - Introduction to Apache Commons Math (update) (#1670)
* BAEL 767 - Introduction to apache commons math

* BAEL 767 - Moving examples to test classes

* BAEL 767 - Renaming tests with BDD convention
2017-04-18 09:58:26 +02:00

21 lines
523 B
Java

package com.baeldung.commons.math;
import org.apache.commons.math3.complex.Complex;
import org.junit.Assert;
import org.junit.Test;
public class ComplexTests {
@Test
public void whenComplexPow_thenCorrect() {
Complex first = new Complex(1.0, 3.0);
Complex second = new Complex(2.0, 5.0);
Complex power = first.pow(second);
Assert.assertEquals(-0.007563724861696302, power.getReal(), 1e-7);
Assert.assertEquals(0.01786136835085382, power.getImaginary(), 1e-7);
}
}