Test of exp method, of class FastMath.
()
| 179 | * Test of exp method, of class FastMath. |
| 180 | */ |
| 181 | @Test |
| 182 | public void testExp() |
| 183 | { |
| 184 | System.out.println("exp"); |
| 185 | DoubleList relErrs = new DoubleList(); |
| 186 | int trials = 10000; |
| 187 | for(int i = 0; i < trials; i++) |
| 188 | { |
| 189 | double x = rand.nextDouble()*50-25; |
| 190 | relErrs.add(relErr(Math.exp(x), FastMath.exp(x))); |
| 191 | } |
| 192 | Collections.sort(relErrs); |
| 193 | assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Test of digamma method, of class FastMath. |