Test of log2_2pd1 method, of class FastMath.
()
| 72 | * Test of log2_2pd1 method, of class FastMath. |
| 73 | */ |
| 74 | @Test |
| 75 | public void testLog2_2pd1() |
| 76 | { |
| 77 | System.out.println("log2_2pd1"); |
| 78 | DoubleList relErrs = new DoubleList(); |
| 79 | int trials = 10000; |
| 80 | for(int i = 0; i < trials; i++) |
| 81 | { |
| 82 | double x = rand.nextDouble()*1000; |
| 83 | relErrs.add(relErr(Math.log(x)/Math.log(2), FastMath.log2_2pd1(x))); |
| 84 | } |
| 85 | Collections.sort(relErrs); |
| 86 | assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Test of log2_c11 method, of class FastMath. |