Test of log2_c11 method, of class FastMath.
()
| 90 | * Test of log2_c11 method, of class FastMath. |
| 91 | */ |
| 92 | @Test |
| 93 | public void testLog2_c11() |
| 94 | { |
| 95 | System.out.println("log2_c11"); |
| 96 | DoubleList relErrs = new DoubleList(); |
| 97 | int trials = 10000; |
| 98 | for(int i = 0; i < trials; i++) |
| 99 | { |
| 100 | double x = rand.nextDouble()*1000; |
| 101 | relErrs.add(relErr(Math.log(x)/Math.log(2), FastMath.log2_c11(x))); |
| 102 | } |
| 103 | Collections.sort(relErrs); |
| 104 | assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Test of pow2 method, of class FastMath. |