MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testLog

Method testLog

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

Test of log method, of class FastMath.

()

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected