Unit test for "FastMath.pow(double,int)".

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1371170 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2012-08-09 11:40:01 +00:00
parent 0ee65b7169
commit dbe216ce60
1 changed files with 14 additions and 0 deletions

View File

@ -1105,4 +1105,18 @@ public class FastMathTest {
Assert.assertEquals(1.0F, FastMath.copySign(1d, 0.0F), delta);
Assert.assertEquals(-1.0F, FastMath.copySign(1d, -2.0F), delta);
}
@Test
public void testIntPow() {
final double base = 1.23456789;
final int maxExp = 300;
for (int i = 0; i < maxExp; i++) {
final double expected = FastMath.pow(base, (double) i);
Assert.assertEquals("exp=" + i,
expected,
FastMath.pow(base, i),
60 * Math.ulp(expected));
}
}
}