Adapt to new API ("Commons Numbers").

This commit is contained in:
Gilles Sadowski 2021-06-04 00:23:52 +02:00
parent 8f39a414c1
commit b574149094
1 changed files with 4 additions and 4 deletions

View File

@ -53,7 +53,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 1.0e-13);
Assert.assertEquals(w, fitted[1], 1.0e-13);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.apply(Angle.Rad.of(fitted[2])).getAsDouble(), 1e-13);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.applyAsDouble(fitted[2]), 1e-13);
final HarmonicOscillator ff = new HarmonicOscillator(fitted[0], fitted[1], fitted[2]);
for (double x = -1.0; x < 1.0; x += 0.01) {
@ -78,7 +78,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 7.6e-4);
Assert.assertEquals(w, fitted[1], 2.7e-3);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.apply(Angle.Rad.of(fitted[2])).getAsDouble(), 1.3e-2);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.applyAsDouble(fitted[2]), 1.3e-2);
}
@Test
@ -115,7 +115,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 1.2e-3);
Assert.assertEquals(w, fitted[1], 3.3e-3);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.apply(Angle.Rad.of(fitted[2])).getAsDouble(), 1.7e-2);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.applyAsDouble(fitted[2]), 1.7e-2);
}
@Test
@ -157,7 +157,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 7.6e-4);
Assert.assertEquals(w, fitted[1], 3.5e-3);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.apply(Angle.Rad.of(fitted[2])).getAsDouble(), 1.5e-2);
Assert.assertEquals(p, Angle.Rad.WITHIN_0_AND_2PI.applyAsDouble(fitted[2]), 1.5e-2);
}
@Test(expected=MathIllegalStateException.class)