MCPcopy Index your code
hub / github.com/EdwardRaff/JSAT / testLog2

Method testLog2

JSAT/test/jsat/math/FastMathTest.java:56–69  ·  view source on GitHub ↗

Test of log2 method, of class FastMath.

()

Source from the content-addressed store, hash-verified

54 * Test of log2 method, of class FastMath.
55 */
56 @Test
57 public void testLog2()
58 {
59 System.out.println("log2");
60 DoubleList relErrs = new DoubleList();
61 int trials = 10000;
62 for(int i = 0; i < trials; i++)
63 {
64 double x = rand.nextDouble()*1000;
65 relErrs.add(relErr(Math.log(x)/Math.log(2), FastMath.log2(x)));
66 }
67 Collections.sort(relErrs);
68 assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3);
69 }
70
71 /**
72 * Test of log2_2pd1 method, of class FastMath.

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
relErrMethod · 0.95
log2Method · 0.95
getMethod · 0.95
logMethod · 0.80
nextDoubleMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected