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

Method testPow2_double

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

Test of pow2 method, of class FastMath.

()

Source from the content-addressed store, hash-verified

119 * Test of pow2 method, of class FastMath.
120 */
121 @Test
122 public void testPow2_double()
123 {
124 System.out.println("pow2");
125 DoubleList relErrs = new DoubleList();
126 int trials = 10000;
127 for(int i = 0; i < trials; i++)
128 {
129 double x = rand.nextDouble()*20;
130 relErrs.add(relErr(Math.pow(2, x), FastMath.pow2(x)));
131 }
132 Collections.sort(relErrs);
133 assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3);
134
135 }
136
137 /**
138 * Test of pow method, of class FastMath.

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
relErrMethod · 0.95
pow2Method · 0.95
getMethod · 0.95
nextDoubleMethod · 0.45
powMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected