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

Method testExp

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

Test of exp method, of class FastMath.

()

Source from the content-addressed store, hash-verified

179 * Test of exp method, of class FastMath.
180 */
181 @Test
182 public void testExp()
183 {
184 System.out.println("exp");
185 DoubleList relErrs = new DoubleList();
186 int trials = 10000;
187 for(int i = 0; i < trials; i++)
188 {
189 double x = rand.nextDouble()*50-25;
190 relErrs.add(relErr(Math.exp(x), FastMath.exp(x)));
191 }
192 Collections.sort(relErrs);
193 assertTrue(relErrs.get((int) (trials*.95)) <= 1e-3);
194 }
195
196 /**
197 * Test of digamma method, of class FastMath.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected