Test of digamma method, of class FastMath.
()
| 197 | * Test of digamma method, of class FastMath. |
| 198 | */ |
| 199 | @Test |
| 200 | public void testDigamma() |
| 201 | { |
| 202 | System.out.println("digamma"); |
| 203 | DoubleList relErrs = new DoubleList(); |
| 204 | int trials = 10000; |
| 205 | for(int i = 0; i < trials; i++) |
| 206 | { |
| 207 | double x = rand.nextDouble()*50; |
| 208 | relErrs.add(relErr(SpecialMath.digamma(x), FastMath.digamma(x))); |
| 209 | } |
| 210 | Collections.sort(relErrs); |
| 211 | assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3); |
| 212 | } |
| 213 | } |