Test of log method, of class FastMath.
()
| 161 | * Test of log method, of class FastMath. |
| 162 | */ |
| 163 | @Test |
| 164 | public void testLog() |
| 165 | { |
| 166 | System.out.println("log"); |
| 167 | DoubleList relErrs = new DoubleList(); |
| 168 | int trials = 10000; |
| 169 | for(int i = 0; i < trials; i++) |
| 170 | { |
| 171 | double x = rand.nextDouble()*20+1e-15; |
| 172 | relErrs.add(relErr(Math.log(x), FastMath.log(x))); |
| 173 | } |
| 174 | Collections.sort(relErrs); |
| 175 | assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Test of exp method, of class FastMath. |