1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.hipparchus.analysis.differentiation;
19
20 import org.hipparchus.dfp.Dfp;
21 import org.hipparchus.dfp.DfpField;
22 import org.hipparchus.random.RandomGenerator;
23 import org.hipparchus.random.Well19937a;
24 import org.hipparchus.util.FastMath;
25 import org.junit.Assert;
26 import org.junit.Test;
27
28
29
30
31 public class FieldUnivariateDerivative1DfpTest extends FieldUnivariateDerivative1AbstractTest<Dfp> {
32
33 private static final DfpField FIELD = new DfpField(25);
34
35 @Override
36 protected DfpField getValueField() {
37 return FIELD;
38 }
39
40 @Test
41 public void testHashcode() {
42 Assert.assertEquals(1305820342, build(2, 1).hashCode());
43 }
44
45 @Override
46 @Test
47 public void testLinearCombinationReference() {
48 doTestLinearCombinationReference(x -> build(x), 5.0e-9, 4.212e-9);
49 }
50
51 @Override
52 @Test
53 public void testUlp() {
54 final RandomGenerator random = new Well19937a(0x36d4f8862421e0e4l);
55 for (int i = -300; i < 300; ++i) {
56 final double x = FastMath.scalb(2.0 * random.nextDouble() - 1.0, i);
57 Assert.assertTrue(FastMath.ulp(x) >= build(x).ulp().getReal());
58 }
59 }
60
61 @Override
62 @Test
63 public void testUlpVsDS() {
64
65 }
66
67 }