You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2016/08/05 15:06:49 UTC

[1/7] [math] Renamed o.h.stat.inference.TestUtils to InferenceTestUtils

Repository: commons-math
Updated Branches:
  refs/heads/develop dccc12554 -> 819318486


http://git-wip-us.apache.org/repos/asf/commons-math/blob/5c341d9d/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
deleted file mode 100644
index b22131e..0000000
--- a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.stat.inference;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math4.distribution.NormalDistribution;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.NotPositiveException;
-import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-import org.apache.commons.math4.exception.NullArgumentException;
-import org.apache.commons.math4.exception.NumberIsTooSmallException;
-import org.apache.commons.math4.exception.OutOfRangeException;
-import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math4.stat.inference.OneWayAnova;
-import org.apache.commons.math4.stat.inference.TestUtils;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-
-
-/**
- * Test cases for the TestUtils class.
- *
- */
-public class TestUtilsTest {
-
-    @Test
-    public void testChiSquare() {
-
-        // Target values computed using R version 1.8.1
-        // Some assembly required ;-)
-        //      Use sum((obs - exp)^2/exp) for the chi-square statistic and
-        //      1 - pchisq(sum((obs - exp)^2/exp), length(obs) - 1) for the p-value
-
-        long[] observed = {10, 9, 11};
-        double[] expected = {10, 10, 10};
-        Assert.assertEquals("chi-square statistic", 0.2,  TestUtils.chiSquare(expected, observed), 10E-12);
-        Assert.assertEquals("chi-square p-value", 0.904837418036, TestUtils.chiSquareTest(expected, observed), 1E-10);
-
-        long[] observed1 = { 500, 623, 72, 70, 31 };
-        double[] expected1 = { 485, 541, 82, 61, 37 };
-        Assert.assertEquals( "chi-square test statistic", 9.023307936427388, TestUtils.chiSquare(expected1, observed1), 1E-10);
-        Assert.assertEquals("chi-square p-value", 0.06051952647453607, TestUtils.chiSquareTest(expected1, observed1), 1E-9);
-        Assert.assertTrue("chi-square test reject", TestUtils.chiSquareTest(expected1, observed1, 0.07));
-        Assert.assertTrue("chi-square test accept", !TestUtils.chiSquareTest(expected1, observed1, 0.05));
-
-        try {
-            TestUtils.chiSquareTest(expected1, observed1, 95);
-            Assert.fail("alpha out of range, OutOfRangeException expected");
-        } catch (OutOfRangeException ex) {
-            // expected
-        }
-
-        long[] tooShortObs = { 0 };
-        double[] tooShortEx = { 1 };
-        try {
-            TestUtils.chiSquare(tooShortEx, tooShortObs);
-            Assert.fail("arguments too short, DimensionMismatchException expected");
-        } catch (DimensionMismatchException ex) {
-            // expected
-        }
-
-        // unmatched arrays
-        long[] unMatchedObs = { 0, 1, 2, 3 };
-        double[] unMatchedEx = { 1, 1, 2 };
-        try {
-            TestUtils.chiSquare(unMatchedEx, unMatchedObs);
-            Assert.fail("arrays have different lengths, DimensionMismatchException expected");
-        } catch (DimensionMismatchException ex) {
-            // expected
-        }
-
-        // 0 expected count
-        expected[0] = 0;
-        try {
-            TestUtils.chiSquareTest(expected, observed, .01);
-            Assert.fail("bad expected count, NotStrictlyPositiveException expected");
-        } catch (NotStrictlyPositiveException ex) {
-            // expected
-        }
-
-        // negative observed count
-        expected[0] = 1;
-        observed[0] = -1;
-        try {
-            TestUtils.chiSquareTest(expected, observed, .01);
-            Assert.fail("bad expected count, NotPositiveException expected");
-        } catch (NotPositiveException ex) {
-            // expected
-        }
-
-    }
-
-    @Test
-    public void testChiSquareIndependence() {
-
-        // Target values computed using R version 1.8.1
-
-        long[][] counts = { {40, 22, 43}, {91, 21, 28}, {60, 10, 22}};
-        Assert.assertEquals( "chi-square test statistic", 22.709027688, TestUtils.chiSquare(counts), 1E-9);
-        Assert.assertEquals("chi-square p-value", 0.000144751460134, TestUtils.chiSquareTest(counts), 1E-9);
-        Assert.assertTrue("chi-square test reject", TestUtils.chiSquareTest(counts, 0.0002));
-        Assert.assertTrue("chi-square test accept", !TestUtils.chiSquareTest(counts, 0.0001));
-
-        long[][] counts2 = {{10, 15}, {30, 40}, {60, 90} };
-        Assert.assertEquals( "chi-square test statistic", 0.168965517241, TestUtils.chiSquare(counts2), 1E-9);
-        Assert.assertEquals("chi-square p-value",0.918987499852, TestUtils.chiSquareTest(counts2), 1E-9);
-        Assert.assertTrue("chi-square test accept", !TestUtils.chiSquareTest(counts2, 0.1));
-
-        // ragged input array
-        long[][] counts3 = { {40, 22, 43}, {91, 21, 28}, {60, 10}};
-        try {
-            TestUtils.chiSquare(counts3);
-            Assert.fail("Expecting DimensionMismatchException");
-        } catch (DimensionMismatchException ex) {
-            // expected
-        }
-
-        // insufficient data
-        long[][] counts4 = {{40, 22, 43}};
-        try {
-            TestUtils.chiSquare(counts4);
-            Assert.fail("Expecting DimensionMismatchException");
-        } catch (DimensionMismatchException ex) {
-            // expected
-        }
-        long[][] counts5 = {{40}, {40}, {30}, {10}};
-        try {
-            TestUtils.chiSquare(counts5);
-            Assert.fail("Expecting DimensionMismatchException");
-        } catch (DimensionMismatchException ex) {
-            // expected
-        }
-
-        // negative counts
-        long[][] counts6 = {{10, -2}, {30, 40}, {60, 90} };
-        try {
-            TestUtils.chiSquare(counts6);
-            Assert.fail("Expecting NotPositiveException");
-        } catch (NotPositiveException ex) {
-            // expected
-        }
-
-        // bad alpha
-        try {
-            TestUtils.chiSquareTest(counts, 0);
-            Assert.fail("Expecting OutOfRangeException");
-        } catch (OutOfRangeException ex) {
-            // expected
-        }
-    }
-
-    @Test
-    public void testChiSquareLargeTestStatistic() {
-        double[] exp = new double[] {
-                3389119.5, 649136.6, 285745.4, 25357364.76, 11291189.78, 543628.0,
-                232921.0, 437665.75
-        };
-
-        long[] obs = new long[] {
-                2372383, 584222, 257170, 17750155, 7903832, 489265, 209628, 393899
-        };
-        org.apache.commons.math4.stat.inference.ChiSquareTest csti =
-            new org.apache.commons.math4.stat.inference.ChiSquareTest();
-        double cst = csti.chiSquareTest(exp, obs);
-        Assert.assertEquals("chi-square p-value", 0.0, cst, 1E-3);
-        Assert.assertEquals( "chi-square test statistic",
-                114875.90421929007, TestUtils.chiSquare(exp, obs), 1E-9);
-    }
-
-    /** Contingency table containing zeros - PR # 32531 */
-    @Test
-    public void testChiSquareZeroCount() {
-        // Target values computed using R version 1.8.1
-        long[][] counts = { {40, 0, 4}, {91, 1, 2}, {60, 2, 0}};
-        Assert.assertEquals( "chi-square test statistic", 9.67444662263,
-                TestUtils.chiSquare(counts), 1E-9);
-        Assert.assertEquals("chi-square p-value", 0.0462835770603,
-                TestUtils.chiSquareTest(counts), 1E-9);
-    }
-
-    private double[] tooShortObs = { 1.0 };
-    private double[] emptyObs = {};
-    private SummaryStatistics emptyStats = new SummaryStatistics();
-
-    @Test
-    public void testOneSampleT() {
-        double[] observed =
-            {93.0, 103.0, 95.0, 101.0, 91.0, 105.0, 96.0, 94.0, 101.0,  88.0, 98.0, 94.0, 101.0, 92.0, 95.0 };
-        double mu = 100.0;
-        SummaryStatistics sampleStats = null;
-        sampleStats = new SummaryStatistics();
-        for (int i = 0; i < observed.length; i++) {
-            sampleStats.addValue(observed[i]);
-        }
-
-        // Target comparison values computed using R version 1.8.1 (Linux version)
-        Assert.assertEquals("t statistic",  -2.81976445346,
-                TestUtils.t(mu, observed), 10E-10);
-        Assert.assertEquals("t statistic",  -2.81976445346,
-                TestUtils.t(mu, sampleStats), 10E-10);
-        Assert.assertEquals("p value", 0.0136390585873,
-                TestUtils.tTest(mu, observed), 10E-10);
-        Assert.assertEquals("p value", 0.0136390585873,
-                TestUtils.tTest(mu, sampleStats), 10E-10);
-
-        try {
-            TestUtils.t(mu, (double[]) null);
-            Assert.fail("arguments too short, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(mu, (SummaryStatistics) null);
-            Assert.fail("arguments too short, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(mu, emptyObs);
-            Assert.fail("arguments too short, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(mu, emptyStats);
-            Assert.fail("arguments too short, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(mu, tooShortObs);
-            Assert.fail("insufficient data to compute t statistic, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-        try {
-            TestUtils.tTest(mu, tooShortObs);
-            Assert.fail("insufficient data to perform t test, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(mu, (SummaryStatistics) null);
-            Assert.fail("insufficient data to compute t statistic, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-        try {
-            TestUtils.tTest(mu, (SummaryStatistics) null);
-            Assert.fail("insufficient data to perform t test, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-    }
-
-    @Test
-    public void testOneSampleTTest() {
-        double[] oneSidedP =
-            {2d, 0d, 6d, 6d, 3d, 3d, 2d, 3d, -6d, 6d, 6d, 6d, 3d, 0d, 1d, 1d, 0d, 2d, 3d, 3d };
-        SummaryStatistics oneSidedPStats = new SummaryStatistics();
-        for (int i = 0; i < oneSidedP.length; i++) {
-            oneSidedPStats.addValue(oneSidedP[i]);
-        }
-        // Target comparison values computed using R version 1.8.1 (Linux version)
-        Assert.assertEquals("one sample t stat", 3.86485535541,
-                TestUtils.t(0d, oneSidedP), 10E-10);
-        Assert.assertEquals("one sample t stat", 3.86485535541,
-                TestUtils.t(0d, oneSidedPStats),1E-10);
-        Assert.assertEquals("one sample p value", 0.000521637019637,
-                TestUtils.tTest(0d, oneSidedP) / 2d, 10E-10);
-        Assert.assertEquals("one sample p value", 0.000521637019637,
-                TestUtils.tTest(0d, oneSidedPStats) / 2d, 10E-5);
-        Assert.assertTrue("one sample t-test reject", TestUtils.tTest(0d, oneSidedP, 0.01));
-        Assert.assertTrue("one sample t-test reject", TestUtils.tTest(0d, oneSidedPStats, 0.01));
-        Assert.assertTrue("one sample t-test accept", !TestUtils.tTest(0d, oneSidedP, 0.0001));
-        Assert.assertTrue("one sample t-test accept", !TestUtils.tTest(0d, oneSidedPStats, 0.0001));
-
-        try {
-            TestUtils.tTest(0d, oneSidedP, 95);
-            Assert.fail("alpha out of range, OutOfRangeException expected");
-        } catch (OutOfRangeException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.tTest(0d, oneSidedPStats, 95);
-            Assert.fail("alpha out of range, OutOfRangeException expected");
-        } catch (OutOfRangeException ex) {
-            // expected
-        }
-
-    }
-
-    @Test
-    public void testTwoSampleTHeterscedastic() {
-        double[] sample1 = { 7d, -4d, 18d, 17d, -3d, -5d, 1d, 10d, 11d, -2d };
-        double[] sample2 = { -1d, 12d, -1d, -3d, 3d, -5d, 5d, 2d, -11d, -1d, -3d };
-        SummaryStatistics sampleStats1 = new SummaryStatistics();
-        for (int i = 0; i < sample1.length; i++) {
-            sampleStats1.addValue(sample1[i]);
-        }
-        SummaryStatistics sampleStats2 = new SummaryStatistics();
-        for (int i = 0; i < sample2.length; i++) {
-            sampleStats2.addValue(sample2[i]);
-        }
-
-        // Target comparison values computed using R version 1.8.1 (Linux version)
-        Assert.assertEquals("two sample heteroscedastic t stat", 1.60371728768,
-                TestUtils.t(sample1, sample2), 1E-10);
-        Assert.assertEquals("two sample heteroscedastic t stat", 1.60371728768,
-                TestUtils.t(sampleStats1, sampleStats2), 1E-10);
-        Assert.assertEquals("two sample heteroscedastic p value", 0.128839369622,
-                TestUtils.tTest(sample1, sample2), 1E-10);
-        Assert.assertEquals("two sample heteroscedastic p value", 0.128839369622,
-                TestUtils.tTest(sampleStats1, sampleStats2), 1E-10);
-        Assert.assertTrue("two sample heteroscedastic t-test reject",
-                TestUtils.tTest(sample1, sample2, 0.2));
-        Assert.assertTrue("two sample heteroscedastic t-test reject",
-                TestUtils.tTest(sampleStats1, sampleStats2, 0.2));
-        Assert.assertTrue("two sample heteroscedastic t-test accept",
-                !TestUtils.tTest(sample1, sample2, 0.1));
-        Assert.assertTrue("two sample heteroscedastic t-test accept",
-                !TestUtils.tTest(sampleStats1, sampleStats2, 0.1));
-
-        try {
-            TestUtils.tTest(sample1, sample2, .95);
-            Assert.fail("alpha out of range, OutOfRangeException expected");
-        } catch (OutOfRangeException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.tTest(sampleStats1, sampleStats2, .95);
-            Assert.fail("alpha out of range, OutOfRangeException expected");
-        } catch (OutOfRangeException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.tTest(sample1, tooShortObs, .01);
-            Assert.fail("insufficient data, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.tTest(sampleStats1, (SummaryStatistics) null, .01);
-            Assert.fail("insufficient data, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.tTest(sample1, tooShortObs);
-            Assert.fail("insufficient data, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.tTest(sampleStats1, (SummaryStatistics) null);
-            Assert.fail("insufficient data, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(sample1, tooShortObs);
-            Assert.fail("insufficient data, NumberIsTooSmallException expected");
-        } catch (NumberIsTooSmallException ex) {
-            // expected
-        }
-
-        try {
-            TestUtils.t(sampleStats1, (SummaryStatistics) null);
-            Assert.fail("insufficient data, NullArgumentException expected");
-        } catch (NullArgumentException ex) {
-            // expected
-        }
-    }
-    @Test
-    public void testTwoSampleTHomoscedastic() {
-        double[] sample1 ={2, 4, 6, 8, 10, 97};
-        double[] sample2 = {4, 6, 8, 10, 16};
-        SummaryStatistics sampleStats1 = new SummaryStatistics();
-        for (int i = 0; i < sample1.length; i++) {
-            sampleStats1.addValue(sample1[i]);
-        }
-        SummaryStatistics sampleStats2 = new SummaryStatistics();
-        for (int i = 0; i < sample2.length; i++) {
-            sampleStats2.addValue(sample2[i]);
-        }
-
-        // Target comparison values computed using R version 1.8.1 (Linux version)
-        Assert.assertEquals("two sample homoscedastic t stat", 0.73096310086,
-                TestUtils.homoscedasticT(sample1, sample2), 10E-11);
-        Assert.assertEquals("two sample homoscedastic p value", 0.4833963785,
-                TestUtils.homoscedasticTTest(sampleStats1, sampleStats2), 1E-10);
-        Assert.assertTrue("two sample homoscedastic t-test reject",
-                TestUtils.homoscedasticTTest(sample1, sample2, 0.49));
-        Assert.assertTrue("two sample homoscedastic t-test accept",
-                !TestUtils.homoscedasticTTest(sample1, sample2, 0.48));
-    }
-
-    @Test
-    public void testSmallSamples() {
-        double[] sample1 = {1d, 3d};
-        double[] sample2 = {4d, 5d};
-
-        // Target values computed using R, version 1.8.1 (linux version)
-        Assert.assertEquals(-2.2360679775, TestUtils.t(sample1, sample2),
-                1E-10);
-        Assert.assertEquals(0.198727388935, TestUtils.tTest(sample1, sample2),
-                1E-10);
-    }
-
-    @Test
-    public void testPaired() {
-        double[] sample1 = {1d, 3d, 5d, 7d};
-        double[] sample2 = {0d, 6d, 11d, 2d};
-        double[] sample3 = {5d, 7d, 8d, 10d};
-
-        // Target values computed using R, version 1.8.1 (linux version)
-        Assert.assertEquals(-0.3133, TestUtils.pairedT(sample1, sample2), 1E-4);
-        Assert.assertEquals(0.774544295819, TestUtils.pairedTTest(sample1, sample2), 1E-10);
-        Assert.assertEquals(0.001208, TestUtils.pairedTTest(sample1, sample3), 1E-6);
-        Assert.assertFalse(TestUtils.pairedTTest(sample1, sample3, .001));
-        Assert.assertTrue(TestUtils.pairedTTest(sample1, sample3, .002));
-    }
-
-    private double[] classA =
-      {93.0, 103.0, 95.0, 101.0};
-    private double[] classB =
-      {99.0, 92.0, 102.0, 100.0, 102.0};
-    private double[] classC =
-      {110.0, 115.0, 111.0, 117.0, 128.0};
-
-    private List<double[]> classes = new ArrayList<double[]>();
-    private OneWayAnova oneWayAnova = new OneWayAnova();
-
-    @Test
-    public void testOneWayAnovaUtils() {
-        classes.add(classA);
-        classes.add(classB);
-        classes.add(classC);
-        Assert.assertEquals(oneWayAnova.anovaFValue(classes),
-                TestUtils.oneWayAnovaFValue(classes), 10E-12);
-        Assert.assertEquals(oneWayAnova.anovaPValue(classes),
-                TestUtils.oneWayAnovaPValue(classes), 10E-12);
-        Assert.assertEquals(oneWayAnova.anovaTest(classes, 0.01),
-                TestUtils.oneWayAnovaTest(classes, 0.01));
-    }
-    @Test
-    public void testGTestGoodnesOfFit() throws Exception {
-        double[] exp = new double[]{
-            0.54d, 0.40d, 0.05d, 0.01d
-        };
-
-        long[] obs = new long[]{
-            70, 79, 3, 4
-        };
-        Assert.assertEquals("G test statistic",
-                13.144799, TestUtils.g(exp, obs), 1E-5);
-        double p_gtgf = TestUtils.gTest(exp, obs);
-        Assert.assertEquals("g-Test p-value", 0.004333, p_gtgf, 1E-5);
-
-        Assert.assertTrue(TestUtils.gTest(exp, obs, 0.05));
-}
-
-    @Test
-    public void testGTestIndependance() throws Exception {
-        long[] obs1 = new long[]{
-            268, 199, 42
-        };
-
-        long[] obs2 = new long[]{
-            807, 759, 184
-        };
-
-        double g = TestUtils.gDataSetsComparison(obs1, obs2);
-
-        Assert.assertEquals("G test statistic",
-                7.3008170, g, 1E-4);
-        double p_gti = TestUtils.gTestDataSetsComparison(obs1, obs2);
-
-        Assert.assertEquals("g-Test p-value", 0.0259805, p_gti, 1E-4);
-        Assert.assertTrue(TestUtils.gTestDataSetsComparison(obs1, obs2, 0.05));
-    }
-
-    @Test
-    public void testRootLogLikelihood() {
-        // positive where k11 is bigger than expected.
-        Assert.assertTrue(TestUtils.rootLogLikelihoodRatio(904, 21060, 1144, 283012) > 0.0);
-
-        // negative because k11 is lower than expected
-        Assert.assertTrue(TestUtils.rootLogLikelihoodRatio(36, 21928, 60280, 623876) < 0.0);
-
-        Assert.assertEquals(FastMath.sqrt(2.772589), TestUtils.rootLogLikelihoodRatio(1, 0, 0, 1), 0.000001);
-        Assert.assertEquals(-FastMath.sqrt(2.772589), TestUtils.rootLogLikelihoodRatio(0, 1, 1, 0), 0.000001);
-        Assert.assertEquals(FastMath.sqrt(27.72589), TestUtils.rootLogLikelihoodRatio(10, 0, 0, 10), 0.00001);
-
-        Assert.assertEquals(FastMath.sqrt(39.33052), TestUtils.rootLogLikelihoodRatio(5, 1995, 0, 100000), 0.00001);
-        Assert.assertEquals(-FastMath.sqrt(39.33052), TestUtils.rootLogLikelihoodRatio(0, 100000, 5, 1995), 0.00001);
-
-        Assert.assertEquals(FastMath.sqrt(4730.737), TestUtils.rootLogLikelihoodRatio(1000, 1995, 1000, 100000), 0.001);
-        Assert.assertEquals(-FastMath.sqrt(4730.737), TestUtils.rootLogLikelihoodRatio(1000, 100000, 1000, 1995), 0.001);
-
-        Assert.assertEquals(FastMath.sqrt(5734.343), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 100000), 0.001);
-        Assert.assertEquals(FastMath.sqrt(5714.932), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 99000), 0.001);
-    }
-
-    @Test
-    public void testKSOneSample() throws Exception {
-       final NormalDistribution unitNormal = new NormalDistribution(0d, 1d);
-       final double[] sample = KolmogorovSmirnovTestTest.gaussian;
-       final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
-       Assert.assertEquals(0.3172069207622391, TestUtils.kolmogorovSmirnovTest(unitNormal, sample), tol);
-       Assert.assertEquals(0.0932947561266756, TestUtils.kolmogorovSmirnovStatistic(unitNormal, sample), tol);
-    }
-
-    @Test
-    public void testKSTwoSample() throws Exception {
-        final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
-        final double[] smallSample1 = {
-            6, 7, 9, 13, 19, 21, 22, 23, 24
-        };
-        final double[] smallSample2 = {
-            10, 11, 12, 16, 20, 27, 28, 32, 44, 54
-        };
-        Assert
-            .assertEquals(0.105577085453247, TestUtils.kolmogorovSmirnovTest(smallSample1, smallSample2, false), tol);
-        final double d = TestUtils.kolmogorovSmirnovStatistic(smallSample1, smallSample2);
-        Assert.assertEquals(0.5, d, tol);
-        Assert
-        .assertEquals(0.105577085453247, TestUtils.exactP(d, smallSample1.length,smallSample2.length, false), tol);
-    }
-}


[3/7] [math] Fixed DerivativeStructure.pow(0.0).

Posted by eb...@apache.org.
Fixed DerivativeStructure.pow(0.0).

x^0 is always 1.0, regardless of x (even if x is NaN in fact).


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c64856ff
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c64856ff
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c64856ff

Branch: refs/heads/develop
Commit: c64856ff7f49c1c2e3098a36e5951f6e3a6cc366
Parents: 5c341d9
Author: Luc Maisonobe <lu...@orekit.org>
Authored: Fri Aug 5 15:00:08 2016 +0200
Committer: Emmanuel Bourg <eb...@apache.org>
Committed: Fri Aug 5 15:00:08 2016 +0200

----------------------------------------------------------------------
 .../analysis/differentiation/DSCompiler.java    |  7 +++++++
 .../DerivativeStructureTest.java                | 22 ++++++++++++++++++++
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/c64856ff/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
index 7515a18..7d5c163 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
@@ -886,6 +886,13 @@ public class DSCompiler {
     public void pow(final double[] operand, final int operandOffset, final double p,
                     final double[] result, final int resultOffset) {
 
+        if (p == 0) {
+            // special case, x^0 = 1 for all x
+            result[resultOffset] = 1.0;
+            Arrays.fill(result, resultOffset + 1, resultOffset + getSize(), 0);
+            return;
+        }
+
         // create the function value and derivatives
         // [x^p, px^(p-1), p(p-1)x^(p-2), ... ]
         double[] function = new double[1 + order];

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c64856ff/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
index 8d4bf50..8d0c733 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
@@ -31,6 +31,7 @@ import org.apache.commons.math4.rng.RandomSource;
 import org.apache.commons.math4.util.ArithmeticUtils;
 import org.apache.commons.math4.util.CombinatoricsUtils;
 import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -323,6 +324,27 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
                 Assert.assertTrue(Double.isNaN(zeroZero.getPartialDerivative(1, 1, 0)));
             }
 
+            // very special case: 0^0 where the power is a primitive
+            DerivativeStructure zeroDsZeroDouble = new DerivativeStructure(3,  maxOrder, 0, 0.0).pow(0.0);
+            boolean first = true;
+            for (final double d : zeroDsZeroDouble.getAllDerivatives()) {
+                if (first) {
+                    Assert.assertEquals(1.0, d, Precision.EPSILON);
+                    first = false;
+                } else {
+                    Assert.assertEquals(0.0, d, Precision.SAFE_MIN);
+                }
+            }
+            DerivativeStructure zeroDsZeroInt = new DerivativeStructure(3,  maxOrder, 0, 0.0).pow(0);
+            first = true;
+            for (final double d : zeroDsZeroInt.getAllDerivatives()) {
+                if (first) {
+                    Assert.assertEquals(1.0, d, Precision.EPSILON);
+                    first = false;
+                } else {
+                    Assert.assertEquals(0.0, d, Precision.SAFE_MIN);
+                }
+            }
         }
 
     }


[4/7] [math] Fix DerivativeStructure.pow for 0 argument and power less than 1.

Posted by eb...@apache.org.
Fix DerivativeStructure.pow for 0 argument and power less than 1.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/540564e1
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/540564e1
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/540564e1

Branch: refs/heads/develop
Commit: 540564e190662e6617d8c8974854ded6ff2b365a
Parents: c64856f
Author: Luc Maisonobe <lu...@orekit.org>
Authored: Fri Aug 5 15:05:33 2016 +0200
Committer: Emmanuel Bourg <eb...@apache.org>
Committed: Fri Aug 5 15:05:33 2016 +0200

----------------------------------------------------------------------
 .../math4/analysis/differentiation/DSCompiler.java      |  6 ++++++
 .../differentiation/DerivativeStructureTest.java        | 12 ++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/540564e1/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
index 7d5c163..8e07838 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
@@ -893,6 +893,12 @@ public class DSCompiler {
             return;
         }
 
+        if (operand[operandOffset] == 0) {
+            // special case, 0^p = 0 for all p
+            Arrays.fill(result, resultOffset, resultOffset + getSize(), 0);
+            return;
+        }
+
         // create the function value and derivatives
         // [x^p, px^(p-1), p(p-1)x^(p-2), ... ]
         double[] function = new double[1 + order];

http://git-wip-us.apache.org/repos/asf/commons-math/blob/540564e1/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
index 8d0c733..1bb7718 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
@@ -345,6 +345,18 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
                     Assert.assertEquals(0.0, d, Precision.SAFE_MIN);
                 }
             }
+
+            // 0^p with p smaller than 1.0
+            DerivativeStructure u = new DerivativeStructure(3, maxOrder, 1, -0.0).pow(0.25);
+            for (int i0 = 0; i0 <= maxOrder; ++i0) {
+                for (int i1 = 0; i1 <= maxOrder; ++i1) {
+                    for (int i2 = 0; i2 <= maxOrder; ++i2) {
+                        if (i0 + i1 + i2 <= maxOrder) {
+                            Assert.assertEquals(0.0, u.getPartialDerivative(i0, i1, i2), 1.0e-10);
+                        }
+                    }
+                }
+            }
         }
 
     }


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Rob Tompkins <ch...@gmail.com>.
> On Aug 8, 2016, at 10:40 AM, Emmanuel Bourg <eb...@apache.org> wrote:
> 
> Le 8/08/2016 à 16:22, Gilles a écrit :
> 
>> There are pro and contra; IMO, saving a few characters is not worth
>> wondering upon reading whether "assertEquals" is from (JUnit) "Assert"
>> or Commons Math "TestUtils".
> 
> Seriously, there is little doubt that "assertEquals" comes from JUnit in
> a FooTest class. Everybody is used to that.

Emmanuel has a point here that generally when one comes across “assertEquals(…);” in an arbitrary test class, one concludes that it stems from JUnit. 

If we were going to indeed require assertEquals to be sufficiently generalized, then might we consider creating a class “org.apache.commons.math*.Assert” that extends JUnit’s Assert so that we can simply have one yet retain our math specific generalizations for assertions? It feels like in doing this we could reasonably cover both sides of the argument.

Thoughts?

-Rob

> 
> 
>> When people get accustomed to git, they won't see it as a constraint,
>> rather as second nature.
> 
> I'm accustomed to Git and I see this as a constraint that I don't have
> the time to deal with.
> 
> Emmanuel Bourg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


RE: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by "Dennis E. Hamilton" <de...@acm.org>.
From the peanut gallery, in-line.

> -----Original Message-----
> From: Gilles [mailto:gilles@harfang.homelinux.org]
> Sent: Monday, August 8, 2016 08:50
> To: dev@commons.apache.org
> Subject: Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed
> contract of "Math#round()" in Java 8
> 
> On Mon, 8 Aug 2016 16:40:04 +0200, Emmanuel Bourg wrote:
> > Le 8/08/2016 à 16:22, Gilles a écrit :
> >
> >> There are pro and contra; IMO, saving a few characters is not worth
> >> wondering upon reading whether "assertEquals" is from (JUnit)
> >> "Assert"
> >> or Commons Math "TestUtils".
> >
> > Seriously, there is little doubt that "assertEquals" comes from JUnit
> > in
> > a FooTest class. Everybody is used to that.
[orcmid] 

It is the presumption of tacit knowledge, in an ever-expanding ring, that complicates the on-ramp for newcomers, until they manage to gulp down all of the kool-aid and become perpetrators themselves.  

> 
> My point was that there exists "TestUtils.assertEquals": also for use
> in a unit test class!
> Someone might want to "import static" those too.  In some files
> "Assert"
> would be implied, and in others "TestUtils".  [No big deal: just what
> you gain somewhere you loose somewhere else.]
[orcmid] 

Except it is another dependency that someone has to be careful to check, and we're not talking about small test files here.

> 
> I have no problem deciding that static import of Junit's Assert methods
> is allowed.  But let's be clear that it does extend to other classes.
> 
> >> When people get accustomed to git, they won't see it as a
> >> constraint,
> >> rather as second nature.
> >
> > I'm accustomed to Git and I see this as a constraint that I don't
> > have
> > the time to deal with.
> 
> Hence, you assume that reviewers are either not necessary, or that
> they their time is worth less than yours.
> 
> We can (have to, actually) understand that long-time committers
> will take a short-cut sometimes, but whenever it happens it should
> not be a massive commit.  Otherwise anything goes.  I hope that you
> can agree that it should not be advertised as good practice.
[orcmid] 

+1 with regard to paying attention to sustainability and community.

> 
> 
> Regards,
> Gilles
> 
> >
> > Emmanuel Bourg
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 8/08/2016 � 17:50, Gilles a �crit :

> Hence, you assume that reviewers are either not necessary, or that
> they their time is worth less than yours.

From my experience it doesn't take more time to review a one commit
change on a branch or on the trunk.

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Gilles <gi...@harfang.homelinux.org>.
On Mon, 8 Aug 2016 16:40:04 +0200, Emmanuel Bourg wrote:
> Le 8/08/2016 � 16:22, Gilles a �crit :
>
>> There are pro and contra; IMO, saving a few characters is not worth
>> wondering upon reading whether "assertEquals" is from (JUnit) 
>> "Assert"
>> or Commons Math "TestUtils".
>
> Seriously, there is little doubt that "assertEquals" comes from JUnit 
> in
> a FooTest class. Everybody is used to that.

My point was that there exists "TestUtils.assertEquals": also for use
in a unit test class!
Someone might want to "import static" those too.  In some files 
"Assert"
would be implied, and in others "TestUtils".  [No big deal: just what
you gain somewhere you loose somewhere else.]

I have no problem deciding that static import of Junit's Assert methods
is allowed.  But let's be clear that it does extend to other classes.

>> When people get accustomed to git, they won't see it as a 
>> constraint,
>> rather as second nature.
>
> I'm accustomed to Git and I see this as a constraint that I don't 
> have
> the time to deal with.

Hence, you assume that reviewers are either not necessary, or that
they their time is worth less than yours.

We can (have to, actually) understand that long-time committers
will take a short-cut sometimes, but whenever it happens it should
not be a massive commit.  Otherwise anything goes.  I hope that you
can agree that it should not be advertised as good practice.


Regards,
Gilles

>
> Emmanuel Bourg
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 8/08/2016 � 16:22, Gilles a �crit :

> There are pro and contra; IMO, saving a few characters is not worth
> wondering upon reading whether "assertEquals" is from (JUnit) "Assert"
> or Commons Math "TestUtils".

Seriously, there is little doubt that "assertEquals" comes from JUnit in
a FooTest class. Everybody is used to that.


> When people get accustomed to git, they won't see it as a constraint,
> rather as second nature.

I'm accustomed to Git and I see this as a constraint that I don't have
the time to deal with.

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Gilles <gi...@harfang.homelinux.org>.
On Mon, 8 Aug 2016 13:14:18 +0200, Emmanuel Bourg wrote:
> Le 8/08/2016 � 00:42, Gilles a �crit :
>
>> In CM, the usage was to not use "import static".
>
> You should make an exception for the unit tests, otherwise the JUnit 
> 4
> syntax is too verbose (and JUnit 4 was designed with static imports 
> in
> mind).

There are pro and contra; IMO, saving a few characters is not worth
wondering upon reading whether "assertEquals" is from (JUnit) "Assert"
or Commons Math "TestUtils".

>> Excerpts from "CONTRIBUTING.md":
>> + Create a topic branch from where you want to base your work (this 
>> is
>> usually the develop/trunk branch).
>
> This is too complicated for simple changes. Topic branches are
> interesting for long lived branches involving many modifications 
> needing
> review. Forcing a topic branch for any modification is a hassle.

YMMV.
One big advantage of a branch is that reviewers can examine different
"topics" at their will (e.g. out of order).

"Simple" changes are those that do not involve any build risks (such as
a Jenkins failure).  So, mostly: documentation upgrades.

> If you want Commons Math to be welcoming to new contributors you 
> should
> consider relaxing the workflow constraints.

When people get accustomed to git, they won't see it as a constraint,
rather as second nature.

Much better to discuss and modify code when it is in a topic branch
rather than after it was merged into the main one.

I think that it is also much easier to review (by making a diff between
branches rather than search for the appropriate commit ids).

>> If there is a JIRA report, the log must indeed make it 
>> straightforward
>> to find it.
>
> I agree, but is this case I noticed the issue in JIRA after pushing 
> the
> changes.

If performed in a topic branch, the questions prompted by the changes
would have offered the opportunity to add the information in the merge
message.

QED. ;-)


Gilles

>
> Emmanuel Bourg
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 8/08/2016 � 00:42, Gilles a �crit :

> In CM, the usage was to not use "import static".

You should make an exception for the unit tests, otherwise the JUnit 4
syntax is too verbose (and JUnit 4 was designed with static imports in
mind).


> Excerpts from "CONTRIBUTING.md":
> + Create a topic branch from where you want to base your work (this is
> usually the develop/trunk branch).

This is too complicated for simple changes. Topic branches are
interesting for long lived branches involving many modifications needing
review. Forcing a topic branch for any modification is a hassle.

If you want Commons Math to be welcoming to new contributors you should
consider relaxing the workflow constraints.


> If there is a JIRA report, the log must indeed make it straightforward
> to find it.

I agree, but is this case I noticed the issue in JIRA after pushing the
changes.

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sat, 6 Aug 2016 11:46:01 -0700, Dennis E. Hamilton wrote:
>> -----Original Message-----
>> From: Gilles [mailto:gilles@harfang.homelinux.org]
>> Sent: Friday, August 5, 2016 09:11
>> To: Commons Developers List <de...@commons.apache.org>
>> Subject: Re: [5/7] [math] Fix "FastMath#round(..)" to comply to 
>> changed
>> contract of "Math#round()" in Java 8
>>
>> Hi.
>>
>> Changes in this file seem unrelated to the commit message.
>>
>> Gilles
> [orcmid]
>
> Yes, this appears to be a massive change involving what may largely
> be stylistic matters (if that is what Assert.assertMumble <<
> assertMumble is all about).

In CM, the usage was to not use "import static".

> On first glance, it makes an excessive
> change that is extremely difficult to comprehend and review.
>
> What are the practices around expecting small focused single-purpose
> changes and, in this case, a small change that addresses the stated
> purpose of the commit with regard to the contract for 
> FastMath.round()
> and its testing?
>
> Is this [VETO] territory, and would the committer be asked to revert
> the change and break it down?

Excerpts from "CONTRIBUTING.md":
+ Create a topic branch from where you want to base your work (this is 
usually the develop/trunk branch).
+ Make commits of logical units.
+ Respect the original code style:
   + Create minimal diffs - disable on save actions like reformat source 
code or organize imports.
     If you feel the source code should be reformatted create a separate 
PR for this change.
+ Make sure your commit messages are in the proper format. Your commit 
message should contain
   the key of the JIRA issue.
   + For example, a commit message might look like `MATH-852: Adding 
documentation for development`

> I ask this because I don't understand the Commons culture and
> practices in order to know.
>
> Oh, and is there a JIRA about this (the Math.round contract) or some
> other way to tie in whatever scholarship and traceability is involved
> in the specialized case of [MATH] software?  (I may have missed this 
> -
> sorry for asking if already answered.)

If there is a JIRA report, the log must indeed make it straightforward
to find it.

Gilles

>  - Dennis
>
>
>>
>> On Fri, 05 Aug 2016 15:06:53 -0000, ebourg@apache.org wrote:
>> >
>> > http://git-wip-us.apache.org/repos/asf/commons-
>> 
>> math/blob/83b70a37/src/test/java/org/apache/commons/math4/util/FastMathT
>> est.java
>> >
>> > 
>> ----------------------------------------------------------------------
>> > diff --git
>> > a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
>> > b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
>> > index cc95c9c..1f94352 100644
>> > --- 
>> a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
>> > +++ 
>> b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
>> > @@ -16,6 +16,10 @@
>> >   */
>> >  package org.apache.commons.math4.util;
>> >
>> > +import static org.junit.Assert.assertEquals;
>> > +import static org.junit.Assert.assertTrue;
>> > +import static org.junit.Assert.fail;
>> > +
>> >  import java.lang.reflect.Method;
>> >  import java.lang.reflect.Modifier;
>> >  import java.lang.reflect.Type;
>> > @@ -30,8 +34,6 @@ import org.apache.commons.math4.dfp.DfpMath;
>> >  import 
>> org.apache.commons.math4.exception.MathArithmeticException;
>> >  import org.apache.commons.math4.rng.UniformRandomProvider;
>> >  import org.apache.commons.math4.rng.RandomSource;
>> > -import org.apache.commons.math4.util.FastMath;
>> > -import org.apache.commons.math4.util.Precision;
>> >  import org.junit.Assert;
>> >  import org.junit.Before;
>> >  import org.junit.Ignore;
>> > @@ -42,7 +44,6 @@ public class FastMathTest {
>> >      private static final double MAX_ERROR_ULP = 0.51;
>> >      private static final int NUMBER_OF_TRIALS = 1000;
>> >
>> > -
>> >      private DfpField field;
>> >      private UniformRandomProvider generator;
>> >
>> > @@ -67,22 +68,22 @@ public class FastMathTest {
>> >              { Precision.SAFE_MIN, Precision.EPSILON }
>> >          };
>> >          for (double[] pair : pairs) {
>> > -            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] 
>> +
>> > ")",
>> > -                                Math.min(pair[0], pair[1]),
>> > -                                FastMath.min(pair[0], pair[1]),
>> > -                                Precision.EPSILON);
>> > -            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] 
>> +
>> > ")",
>> > -                                Math.min(pair[1], pair[0]),
>> > -                                FastMath.min(pair[1], pair[0]),
>> > -                                Precision.EPSILON);
>> > -            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] 
>> +
>> > ")",
>> > -                                Math.max(pair[0], pair[1]),
>> > -                                FastMath.max(pair[0], pair[1]),
>> > -                                Precision.EPSILON);
>> > -            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] 
>> +
>> > ")",
>> > -                                Math.max(pair[1], pair[0]),
>> > -                                FastMath.max(pair[1], pair[0]),
>> > -                                Precision.EPSILON);
>> > +            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
>> > +                         Math.min(pair[0], pair[1]),
>> > +                         FastMath.min(pair[0], pair[1]),
>> > +                         Precision.EPSILON);
>> > +            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
>> > +                         Math.min(pair[1], pair[0]),
>> > +                         FastMath.min(pair[1], pair[0]),
>> > +                         Precision.EPSILON);
>> > +            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
>> > +                         Math.max(pair[0], pair[1]),
>> > +                         FastMath.max(pair[0], pair[1]),
>> > +                         Precision.EPSILON);
>> > +            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
>> > +                         Math.max(pair[1], pair[0]),
>> > +                         FastMath.max(pair[1], pair[0]),
>> > +                         Precision.EPSILON);
>> >          }
>> >      }
>> >
>> > @@ -100,39 +101,39 @@ public class FastMathTest {
>> >              {  Float.NaN, Float.POSITIVE_INFINITY }
>> >          };
>> >          for (float[] pair : pairs) {
>> > -            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] 
>> +
>> > ")",
>> > -                                Math.min(pair[0], pair[1]),
>> > -                                FastMath.min(pair[0], pair[1]),
>> > -                                Precision.EPSILON);
>> > -            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] 
>> +
>> > ")",
>> > -                                Math.min(pair[1], pair[0]),
>> > -                                FastMath.min(pair[1], pair[0]),
>> > -                                Precision.EPSILON);
>> > -            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] 
>> +
>> > ")",
>> > -                                Math.max(pair[0], pair[1]),
>> > -                                FastMath.max(pair[0], pair[1]),
>> > -                                Precision.EPSILON);
>> > -            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] 
>> +
>> > ")",
>> > -                                Math.max(pair[1], pair[0]),
>> > -                                FastMath.max(pair[1], pair[0]),
>> > -                                Precision.EPSILON);
>> > +            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
>> > +                    Math.min(pair[0], pair[1]),
>> > +                    FastMath.min(pair[0], pair[1]),
>> > +                    Precision.EPSILON);
>> > +            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
>> > +                    Math.min(pair[1], pair[0]),
>> > +                    FastMath.min(pair[1], pair[0]),
>> > +                    Precision.EPSILON);
>> > +            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
>> > +                    Math.max(pair[0], pair[1]),
>> > +                    FastMath.max(pair[0], pair[1]),
>> > +                    Precision.EPSILON);
>> > +            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
>> > +                    Math.max(pair[1], pair[0]),
>> > +                    FastMath.max(pair[1], pair[0]),
>> > +                    Precision.EPSILON);
>> >          }
>> >      }
>> >
>> >      @Test
>> >      public void testConstants() {
>> > -        Assert.assertEquals(Math.PI, FastMath.PI, 1.0e-20);
>> > -        Assert.assertEquals(Math.E, FastMath.E, 1.0e-20);
>> > +        assertEquals(Math.PI, FastMath.PI, 1.0e-20);
>> > +        assertEquals(Math.E, FastMath.E, 1.0e-20);
>> >      }
>> >
>> >
>> > <TRUNCATED>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 6/08/2016 � 20:46, Dennis E. Hamilton a �crit :

> Oh, and is there a JIRA about this (the Math.round contract) or some other way to tie in whatever scholarship and traceability is involved in the specialized case of [MATH] software?  (I may have missed this - sorry for asking if already answered.)

https://issues.apache.org/jira/browse/MATH-1196


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


RE: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by "Dennis E. Hamilton" <de...@acm.org>.

> -----Original Message-----
> From: Gilles [mailto:gilles@harfang.homelinux.org]
> Sent: Friday, August 5, 2016 09:11
> To: Commons Developers List <de...@commons.apache.org>
> Subject: Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed
> contract of "Math#round()" in Java 8
> 
> Hi.
> 
> Changes in this file seem unrelated to the commit message.
> 
> Gilles
[orcmid] 

Yes, this appears to be a massive change involving what may largely be stylistic matters (if that is what Assert.assertMumble << assertMumble is all about).  On first glance, it makes an excessive change that is extremely difficult to comprehend and review.

What are the practices around expecting small focused single-purpose changes and, in this case, a small change that addresses the stated purpose of the commit with regard to the contract for FastMath.round() and its testing?

Is this [VETO] territory, and would the committer be asked to revert the change and break it down?

I ask this because I don't understand the Commons culture and practices in order to know.

Oh, and is there a JIRA about this (the Math.round contract) or some other way to tie in whatever scholarship and traceability is involved in the specialized case of [MATH] software?  (I may have missed this - sorry for asking if already answered.)

 - Dennis


> 
> On Fri, 05 Aug 2016 15:06:53 -0000, ebourg@apache.org wrote:
> >
> > http://git-wip-us.apache.org/repos/asf/commons-
> math/blob/83b70a37/src/test/java/org/apache/commons/math4/util/FastMathT
> est.java
> >
> > ----------------------------------------------------------------------
> > diff --git
> > a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> > b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> > index cc95c9c..1f94352 100644
> > --- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> > +++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> > @@ -16,6 +16,10 @@
> >   */
> >  package org.apache.commons.math4.util;
> >
> > +import static org.junit.Assert.assertEquals;
> > +import static org.junit.Assert.assertTrue;
> > +import static org.junit.Assert.fail;
> > +
> >  import java.lang.reflect.Method;
> >  import java.lang.reflect.Modifier;
> >  import java.lang.reflect.Type;
> > @@ -30,8 +34,6 @@ import org.apache.commons.math4.dfp.DfpMath;
> >  import org.apache.commons.math4.exception.MathArithmeticException;
> >  import org.apache.commons.math4.rng.UniformRandomProvider;
> >  import org.apache.commons.math4.rng.RandomSource;
> > -import org.apache.commons.math4.util.FastMath;
> > -import org.apache.commons.math4.util.Precision;
> >  import org.junit.Assert;
> >  import org.junit.Before;
> >  import org.junit.Ignore;
> > @@ -42,7 +44,6 @@ public class FastMathTest {
> >      private static final double MAX_ERROR_ULP = 0.51;
> >      private static final int NUMBER_OF_TRIALS = 1000;
> >
> > -
> >      private DfpField field;
> >      private UniformRandomProvider generator;
> >
> > @@ -67,22 +68,22 @@ public class FastMathTest {
> >              { Precision.SAFE_MIN, Precision.EPSILON }
> >          };
> >          for (double[] pair : pairs) {
> > -            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] +
> > ")",
> > -                                Math.min(pair[0], pair[1]),
> > -                                FastMath.min(pair[0], pair[1]),
> > -                                Precision.EPSILON);
> > -            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] +
> > ")",
> > -                                Math.min(pair[1], pair[0]),
> > -                                FastMath.min(pair[1], pair[0]),
> > -                                Precision.EPSILON);
> > -            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] +
> > ")",
> > -                                Math.max(pair[0], pair[1]),
> > -                                FastMath.max(pair[0], pair[1]),
> > -                                Precision.EPSILON);
> > -            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] +
> > ")",
> > -                                Math.max(pair[1], pair[0]),
> > -                                FastMath.max(pair[1], pair[0]),
> > -                                Precision.EPSILON);
> > +            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
> > +                         Math.min(pair[0], pair[1]),
> > +                         FastMath.min(pair[0], pair[1]),
> > +                         Precision.EPSILON);
> > +            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
> > +                         Math.min(pair[1], pair[0]),
> > +                         FastMath.min(pair[1], pair[0]),
> > +                         Precision.EPSILON);
> > +            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
> > +                         Math.max(pair[0], pair[1]),
> > +                         FastMath.max(pair[0], pair[1]),
> > +                         Precision.EPSILON);
> > +            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
> > +                         Math.max(pair[1], pair[0]),
> > +                         FastMath.max(pair[1], pair[0]),
> > +                         Precision.EPSILON);
> >          }
> >      }
> >
> > @@ -100,39 +101,39 @@ public class FastMathTest {
> >              {  Float.NaN, Float.POSITIVE_INFINITY }
> >          };
> >          for (float[] pair : pairs) {
> > -            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] +
> > ")",
> > -                                Math.min(pair[0], pair[1]),
> > -                                FastMath.min(pair[0], pair[1]),
> > -                                Precision.EPSILON);
> > -            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] +
> > ")",
> > -                                Math.min(pair[1], pair[0]),
> > -                                FastMath.min(pair[1], pair[0]),
> > -                                Precision.EPSILON);
> > -            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] +
> > ")",
> > -                                Math.max(pair[0], pair[1]),
> > -                                FastMath.max(pair[0], pair[1]),
> > -                                Precision.EPSILON);
> > -            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] +
> > ")",
> > -                                Math.max(pair[1], pair[0]),
> > -                                FastMath.max(pair[1], pair[0]),
> > -                                Precision.EPSILON);
> > +            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
> > +                    Math.min(pair[0], pair[1]),
> > +                    FastMath.min(pair[0], pair[1]),
> > +                    Precision.EPSILON);
> > +            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
> > +                    Math.min(pair[1], pair[0]),
> > +                    FastMath.min(pair[1], pair[0]),
> > +                    Precision.EPSILON);
> > +            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
> > +                    Math.max(pair[0], pair[1]),
> > +                    FastMath.max(pair[0], pair[1]),
> > +                    Precision.EPSILON);
> > +            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
> > +                    Math.max(pair[1], pair[0]),
> > +                    FastMath.max(pair[1], pair[0]),
> > +                    Precision.EPSILON);
> >          }
> >      }
> >
> >      @Test
> >      public void testConstants() {
> > -        Assert.assertEquals(Math.PI, FastMath.PI, 1.0e-20);
> > -        Assert.assertEquals(Math.E, FastMath.E, 1.0e-20);
> > +        assertEquals(Math.PI, FastMath.PI, 1.0e-20);
> > +        assertEquals(Math.E, FastMath.E, 1.0e-20);
> >      }
> >
> >
> > <TRUNCATED>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by Gilles <gi...@harfang.homelinux.org>.
Hi.

Changes in this file seem unrelated to the commit message.

Gilles

On Fri, 05 Aug 2016 15:06:53 -0000, ebourg@apache.org wrote:
> 
> http://git-wip-us.apache.org/repos/asf/commons-math/blob/83b70a37/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> 
> ----------------------------------------------------------------------
> diff --git
> a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> index cc95c9c..1f94352 100644
> --- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> +++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
> @@ -16,6 +16,10 @@
>   */
>  package org.apache.commons.math4.util;
>
> +import static org.junit.Assert.assertEquals;
> +import static org.junit.Assert.assertTrue;
> +import static org.junit.Assert.fail;
> +
>  import java.lang.reflect.Method;
>  import java.lang.reflect.Modifier;
>  import java.lang.reflect.Type;
> @@ -30,8 +34,6 @@ import org.apache.commons.math4.dfp.DfpMath;
>  import org.apache.commons.math4.exception.MathArithmeticException;
>  import org.apache.commons.math4.rng.UniformRandomProvider;
>  import org.apache.commons.math4.rng.RandomSource;
> -import org.apache.commons.math4.util.FastMath;
> -import org.apache.commons.math4.util.Precision;
>  import org.junit.Assert;
>  import org.junit.Before;
>  import org.junit.Ignore;
> @@ -42,7 +44,6 @@ public class FastMathTest {
>      private static final double MAX_ERROR_ULP = 0.51;
>      private static final int NUMBER_OF_TRIALS = 1000;
>
> -
>      private DfpField field;
>      private UniformRandomProvider generator;
>
> @@ -67,22 +68,22 @@ public class FastMathTest {
>              { Precision.SAFE_MIN, Precision.EPSILON }
>          };
>          for (double[] pair : pairs) {
> -            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] + 
> ")",
> -                                Math.min(pair[0], pair[1]),
> -                                FastMath.min(pair[0], pair[1]),
> -                                Precision.EPSILON);
> -            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] + 
> ")",
> -                                Math.min(pair[1], pair[0]),
> -                                FastMath.min(pair[1], pair[0]),
> -                                Precision.EPSILON);
> -            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] + 
> ")",
> -                                Math.max(pair[0], pair[1]),
> -                                FastMath.max(pair[0], pair[1]),
> -                                Precision.EPSILON);
> -            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] + 
> ")",
> -                                Math.max(pair[1], pair[0]),
> -                                FastMath.max(pair[1], pair[0]),
> -                                Precision.EPSILON);
> +            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
> +                         Math.min(pair[0], pair[1]),
> +                         FastMath.min(pair[0], pair[1]),
> +                         Precision.EPSILON);
> +            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
> +                         Math.min(pair[1], pair[0]),
> +                         FastMath.min(pair[1], pair[0]),
> +                         Precision.EPSILON);
> +            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
> +                         Math.max(pair[0], pair[1]),
> +                         FastMath.max(pair[0], pair[1]),
> +                         Precision.EPSILON);
> +            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
> +                         Math.max(pair[1], pair[0]),
> +                         FastMath.max(pair[1], pair[0]),
> +                         Precision.EPSILON);
>          }
>      }
>
> @@ -100,39 +101,39 @@ public class FastMathTest {
>              {  Float.NaN, Float.POSITIVE_INFINITY }
>          };
>          for (float[] pair : pairs) {
> -            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] + 
> ")",
> -                                Math.min(pair[0], pair[1]),
> -                                FastMath.min(pair[0], pair[1]),
> -                                Precision.EPSILON);
> -            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] + 
> ")",
> -                                Math.min(pair[1], pair[0]),
> -                                FastMath.min(pair[1], pair[0]),
> -                                Precision.EPSILON);
> -            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] + 
> ")",
> -                                Math.max(pair[0], pair[1]),
> -                                FastMath.max(pair[0], pair[1]),
> -                                Precision.EPSILON);
> -            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] + 
> ")",
> -                                Math.max(pair[1], pair[0]),
> -                                FastMath.max(pair[1], pair[0]),
> -                                Precision.EPSILON);
> +            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
> +                    Math.min(pair[0], pair[1]),
> +                    FastMath.min(pair[0], pair[1]),
> +                    Precision.EPSILON);
> +            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
> +                    Math.min(pair[1], pair[0]),
> +                    FastMath.min(pair[1], pair[0]),
> +                    Precision.EPSILON);
> +            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
> +                    Math.max(pair[0], pair[1]),
> +                    FastMath.max(pair[0], pair[1]),
> +                    Precision.EPSILON);
> +            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
> +                    Math.max(pair[1], pair[0]),
> +                    FastMath.max(pair[1], pair[0]),
> +                    Precision.EPSILON);
>          }
>      }
>
>      @Test
>      public void testConstants() {
> -        Assert.assertEquals(Math.PI, FastMath.PI, 1.0e-20);
> -        Assert.assertEquals(Math.E, FastMath.E, 1.0e-20);
> +        assertEquals(Math.PI, FastMath.PI, 1.0e-20);
> +        assertEquals(Math.E, FastMath.E, 1.0e-20);
>      }
>
>
> <TRUNCATED>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[5/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by eb...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/83b70a37/src/test/java/org/apache/commons/math4/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathTest.java b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
index cc95c9c..1f94352 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.commons.math4.util;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
@@ -30,8 +34,6 @@ import org.apache.commons.math4.dfp.DfpMath;
 import org.apache.commons.math4.exception.MathArithmeticException;
 import org.apache.commons.math4.rng.UniformRandomProvider;
 import org.apache.commons.math4.rng.RandomSource;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -42,7 +44,6 @@ public class FastMathTest {
     private static final double MAX_ERROR_ULP = 0.51;
     private static final int NUMBER_OF_TRIALS = 1000;
 
-
     private DfpField field;
     private UniformRandomProvider generator;
 
@@ -67,22 +68,22 @@ public class FastMathTest {
             { Precision.SAFE_MIN, Precision.EPSILON }
         };
         for (double[] pair : pairs) {
-            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
-                                Math.min(pair[0], pair[1]),
-                                FastMath.min(pair[0], pair[1]),
-                                Precision.EPSILON);
-            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
-                                Math.min(pair[1], pair[0]),
-                                FastMath.min(pair[1], pair[0]),
-                                Precision.EPSILON);
-            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
-                                Math.max(pair[0], pair[1]),
-                                FastMath.max(pair[0], pair[1]),
-                                Precision.EPSILON);
-            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
-                                Math.max(pair[1], pair[0]),
-                                FastMath.max(pair[1], pair[0]),
-                                Precision.EPSILON);
+            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
+                         Math.min(pair[0], pair[1]),
+                         FastMath.min(pair[0], pair[1]),
+                         Precision.EPSILON);
+            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
+                         Math.min(pair[1], pair[0]),
+                         FastMath.min(pair[1], pair[0]),
+                         Precision.EPSILON);
+            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
+                         Math.max(pair[0], pair[1]),
+                         FastMath.max(pair[0], pair[1]),
+                         Precision.EPSILON);
+            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
+                         Math.max(pair[1], pair[0]),
+                         FastMath.max(pair[1], pair[0]),
+                         Precision.EPSILON);
         }
     }
 
@@ -100,39 +101,39 @@ public class FastMathTest {
             {  Float.NaN, Float.POSITIVE_INFINITY }
         };
         for (float[] pair : pairs) {
-            Assert.assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
-                                Math.min(pair[0], pair[1]),
-                                FastMath.min(pair[0], pair[1]),
-                                Precision.EPSILON);
-            Assert.assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
-                                Math.min(pair[1], pair[0]),
-                                FastMath.min(pair[1], pair[0]),
-                                Precision.EPSILON);
-            Assert.assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
-                                Math.max(pair[0], pair[1]),
-                                FastMath.max(pair[0], pair[1]),
-                                Precision.EPSILON);
-            Assert.assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
-                                Math.max(pair[1], pair[0]),
-                                FastMath.max(pair[1], pair[0]),
-                                Precision.EPSILON);
+            assertEquals("min(" + pair[0] + ", " + pair[1] + ")",
+                    Math.min(pair[0], pair[1]),
+                    FastMath.min(pair[0], pair[1]),
+                    Precision.EPSILON);
+            assertEquals("min(" + pair[1] + ", " + pair[0] + ")",
+                    Math.min(pair[1], pair[0]),
+                    FastMath.min(pair[1], pair[0]),
+                    Precision.EPSILON);
+            assertEquals("max(" + pair[0] + ", " + pair[1] + ")",
+                    Math.max(pair[0], pair[1]),
+                    FastMath.max(pair[0], pair[1]),
+                    Precision.EPSILON);
+            assertEquals("max(" + pair[1] + ", " + pair[0] + ")",
+                    Math.max(pair[1], pair[0]),
+                    FastMath.max(pair[1], pair[0]),
+                    Precision.EPSILON);
         }
     }
 
     @Test
     public void testConstants() {
-        Assert.assertEquals(Math.PI, FastMath.PI, 1.0e-20);
-        Assert.assertEquals(Math.E, FastMath.E, 1.0e-20);
+        assertEquals(Math.PI, FastMath.PI, 1.0e-20);
+        assertEquals(Math.E, FastMath.E, 1.0e-20);
     }
 
     @Test
     public void testAtan2() {
         double y1 = 1.2713504628280707e10;
         double x1 = -5.674940885228782e-10;
-        Assert.assertEquals(Math.atan2(y1, x1), FastMath.atan2(y1, x1), 2 * Precision.EPSILON);
+        assertEquals(Math.atan2(y1, x1), FastMath.atan2(y1, x1), 2 * Precision.EPSILON);
         double y2 = 0.0;
         double x2 = Double.POSITIVE_INFINITY;
-        Assert.assertEquals(Math.atan2(y2, x2), FastMath.atan2(y2, x2), Precision.SAFE_MIN);
+        assertEquals(Math.atan2(y2, x2), FastMath.atan2(y2, x2), Precision.SAFE_MIN);
     }
 
     @Test
@@ -143,7 +144,7 @@ public class FastMathTest {
             double ref = Math.sinh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 2);
+        assertEquals(0, maxErr, 2);
 
         maxErr = 0;
         for (double x = -30; x < 30; x += 0.001) {
@@ -151,7 +152,7 @@ public class FastMathTest {
             double ref = Math.cosh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 2);
+        assertEquals(0, maxErr, 2);
 
         maxErr = 0;
         for (double x = -0.5; x < 0.5; x += 0.001) {
@@ -159,7 +160,7 @@ public class FastMathTest {
             double ref = Math.tanh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 4);
+        assertEquals(0, maxErr, 4);
 
     }
 
@@ -167,10 +168,10 @@ public class FastMathTest {
     public void testMath904() {
         final double x = -1;
         final double y = (5 + 1e-15) * 1e15;
-        Assert.assertEquals(Math.pow(x, y),
-                            FastMath.pow(x, y), 0);
-        Assert.assertEquals(Math.pow(x, -y),
-                            FastMath.pow(x, -y), 0);
+        assertEquals(Math.pow(x, y),
+                     FastMath.pow(x, y), 0);
+        assertEquals(Math.pow(x, -y),
+                FastMath.pow(x, -y), 0);
     }
 
     @Test
@@ -185,14 +186,14 @@ public class FastMathTest {
             final double ref = Math.cosh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 3);
+        assertEquals(0, maxErr, 3);
 
         for (double x = start; x < end; x += 1e-3) {
             final double tst = FastMath.sinh(x);
             final double ref = Math.sinh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 3);
+        assertEquals(0, maxErr, 3);
     }
 
     @Test
@@ -207,14 +208,14 @@ public class FastMathTest {
             final double ref = Math.cosh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 3);
+        assertEquals(0, maxErr, 3);
 
         for (double x = start; x > end; x -= 1e-3) {
             final double tst = FastMath.sinh(x);
             final double ref = Math.sinh(x);
             maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
-        Assert.assertEquals(0, maxErr, 3);
+        assertEquals(0, maxErr, 3);
     }
 
     @Test
@@ -222,8 +223,8 @@ public class FastMathTest {
         final double arg = 709.8125;
         final double vM = Math.exp(arg);
         final double vFM = FastMath.exp(arg);
-        Assert.assertTrue("exp(" + arg + ") is " + vFM + " instead of " + vM,
-                          Precision.equalsIncludingNaN(vM, vFM));
+        assertTrue("exp(" + arg + ") is " + vFM + " instead of " + vM,
+                Precision.equalsIncludingNaN(vM, vFM));
     }
 
     @Test
@@ -232,20 +233,19 @@ public class FastMathTest {
         for (double x = -30; x < 30; x += 0.01) {
             maxErr = FastMath.max(maxErr, FastMath.abs(x - FastMath.sinh(FastMath.asinh(x))) / (2 * FastMath.ulp(x)));
         }
-        Assert.assertEquals(0, maxErr, 3);
+        assertEquals(0, maxErr, 3);
 
         maxErr = 0;
         for (double x = 1; x < 30; x += 0.01) {
             maxErr = FastMath.max(maxErr, FastMath.abs(x - FastMath.cosh(FastMath.acosh(x))) / (2 * FastMath.ulp(x)));
         }
-        Assert.assertEquals(0, maxErr, 2);
+        assertEquals(0, maxErr, 2);
 
         maxErr = 0;
         for (double x = -1 + Precision.EPSILON; x < 1 - Precision.EPSILON; x += 0.0001) {
             maxErr = FastMath.max(maxErr, FastMath.abs(x - FastMath.tanh(FastMath.atanh(x))) / (2 * FastMath.ulp(x)));
         }
-        Assert.assertEquals(0, maxErr, 2);
-
+        assertEquals(0, maxErr, 2);
     }
 
     @Test
@@ -261,8 +261,7 @@ public class FastMathTest {
 
             if (err != 0.0) {
                 double ulp = Math.abs(ref -
-                                      Double.longBitsToDouble((Double
-                                          .doubleToLongBits(ref) ^ 1)));
+                                      Double.longBitsToDouble((Double.doubleToLongBits(ref) ^ 1)));
                 double errulp = field.newDfp(tst).subtract(DfpMath.log(field.newDfp(x))).divide(field.newDfp(ulp)).toDouble();
 //                System.out.println(x + "\t" + tst + "\t" + ref + "\t" + err + "\t" + errulp);
 
@@ -270,7 +269,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("log() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("log() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -294,7 +293,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("log10() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("log10() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -318,302 +317,237 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("log1p() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("log1p() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
     public void testLog1pSpecialCases() {
-
-        Assert.assertTrue("Logp of -1.0 should be -Inf", Double.isInfinite(FastMath.log1p(-1.0)));
-
+        assertTrue("Logp of -1.0 should be -Inf", Double.isInfinite(FastMath.log1p(-1.0)));
     }
 
     @Test
     public void testLogSpecialCases() {
-
-        Assert.assertEquals("Log of zero should be -Inf", Double.NEGATIVE_INFINITY, FastMath.log(0.0), 1.0);
-
-        Assert.assertEquals("Log of -zero should be -Inf", Double.NEGATIVE_INFINITY, FastMath.log(-0.0), 1.0);
-
-        Assert.assertTrue("Log of NaN should be NaN", Double.isNaN(FastMath.log(Double.NaN)));
-
-        Assert.assertTrue("Log of negative number should be NaN", Double.isNaN(FastMath.log(-1.0)));
-
-        Assert.assertEquals("Log of Double.MIN_VALUE should be -744.4400719213812", -744.4400719213812, FastMath.log(Double.MIN_VALUE), Precision.EPSILON);
-
-        Assert.assertEquals("Log of infinity should be infinity", Double.POSITIVE_INFINITY, FastMath.log(Double.POSITIVE_INFINITY), 1.0);
+        assertEquals("Log of zero should be -Inf", Double.NEGATIVE_INFINITY, FastMath.log(0.0), 1.0);
+        assertEquals("Log of -zero should be -Inf", Double.NEGATIVE_INFINITY, FastMath.log(-0.0), 1.0);
+        assertTrue("Log of NaN should be NaN", Double.isNaN(FastMath.log(Double.NaN)));
+        assertTrue("Log of negative number should be NaN", Double.isNaN(FastMath.log(-1.0)));
+        assertEquals("Log of Double.MIN_VALUE should be -744.4400719213812", -744.4400719213812, FastMath.log(Double.MIN_VALUE), Precision.EPSILON);
+        assertEquals("Log of infinity should be infinity", Double.POSITIVE_INFINITY, FastMath.log(Double.POSITIVE_INFINITY), 1.0);
     }
 
     @Test
     public void testExpSpecialCases() {
-
         // Smallest value that will round up to Double.MIN_VALUE
-        Assert.assertEquals(Double.MIN_VALUE, FastMath.exp(-745.1332191019411), Precision.EPSILON);
-
-        Assert.assertEquals("exp(-745.1332191019412) should be 0.0", 0.0, FastMath.exp(-745.1332191019412), Precision.EPSILON);
-
-        Assert.assertTrue("exp of NaN should be NaN", Double.isNaN(FastMath.exp(Double.NaN)));
-
-        Assert.assertEquals("exp of infinity should be infinity", Double.POSITIVE_INFINITY, FastMath.exp(Double.POSITIVE_INFINITY), 1.0);
-
-        Assert.assertEquals("exp of -infinity should be 0.0", 0.0, FastMath.exp(Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("exp(1) should be Math.E", Math.E, FastMath.exp(1.0), Precision.EPSILON);
+        assertEquals(Double.MIN_VALUE, FastMath.exp(-745.1332191019411), Precision.EPSILON);
+        assertEquals("exp(-745.1332191019412) should be 0.0", 0.0, FastMath.exp(-745.1332191019412), Precision.EPSILON);
+        assertTrue("exp of NaN should be NaN", Double.isNaN(FastMath.exp(Double.NaN)));
+        assertEquals("exp of infinity should be infinity", Double.POSITIVE_INFINITY, FastMath.exp(Double.POSITIVE_INFINITY), 1.0);
+        assertEquals("exp of -infinity should be 0.0", 0.0, FastMath.exp(Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("exp(1) should be Math.E", Math.E, FastMath.exp(1.0), Precision.EPSILON);
     }
 
     @Test
     public void testPowSpecialCases() {
         final double EXACT = -1.0;
 
-        Assert.assertEquals("pow(-1, 0) should be 1.0", 1.0, FastMath.pow(-1.0, 0.0), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-1, -0) should be 1.0", 1.0, FastMath.pow(-1.0, -0.0), Precision.EPSILON);
-
-        Assert.assertEquals("pow(PI, 1.0) should be PI", FastMath.PI, FastMath.pow(FastMath.PI, 1.0), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-PI, 1.0) should be -PI", -FastMath.PI, FastMath.pow(-FastMath.PI, 1.0), Precision.EPSILON);
-
-        Assert.assertTrue("pow(PI, NaN) should be NaN", Double.isNaN(FastMath.pow(Math.PI, Double.NaN)));
-
-        Assert.assertTrue("pow(NaN, PI) should be NaN", Double.isNaN(FastMath.pow(Double.NaN, Math.PI)));
-
-        Assert.assertEquals("pow(2.0, Infinity) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(2.0, Double.POSITIVE_INFINITY), 1.0);
-
-        Assert.assertEquals("pow(0.5, -Infinity) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(0.5, Double.NEGATIVE_INFINITY), 1.0);
-
-        Assert.assertEquals("pow(0.5, Infinity) should be 0.0", 0.0, FastMath.pow(0.5, Double.POSITIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("pow(2.0, -Infinity) should be 0.0", 0.0, FastMath.pow(2.0, Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("pow(0.0, 0.5) should be 0.0", 0.0, FastMath.pow(0.0, 0.5), Precision.EPSILON);
-
-        Assert.assertEquals("pow(Infinity, -0.5) should be 0.0", 0.0, FastMath.pow(Double.POSITIVE_INFINITY, -0.5), Precision.EPSILON);
-
-        Assert.assertEquals("pow(0.0, -0.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(0.0, -0.5), 1.0);
-
-        Assert.assertEquals("pow(Inf, 0.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(Double.POSITIVE_INFINITY, 0.5), 1.0);
-
-        Assert.assertEquals("pow(-0.0, -3.0) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(-0.0, -3.0), 1.0);
-
-        Assert.assertEquals("pow(-0.0, Infinity) should be 0.0", 0.0, FastMath.pow(-0.0, Double.POSITIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertTrue("pow(-0.0, NaN) should be NaN", Double.isNaN(FastMath.pow(-0.0, Double.NaN)));
-
-        Assert.assertEquals("pow(-0.0, -tiny) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -Double.MIN_VALUE), 1.0);
-
-        Assert.assertEquals("pow(-0.0, -huge) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -Double.MAX_VALUE), 1.0);
-
-        Assert.assertEquals("pow(-Inf, 3.0) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, 3.0), 1.0);
-
-        Assert.assertEquals("pow(-Inf, -3.0) should be -0.0", -0.0, FastMath.pow(Double.NEGATIVE_INFINITY, -3.0), EXACT);
-
-        Assert.assertEquals("pow(-0.0, -3.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -3.5), 1.0);
-
-        Assert.assertEquals("pow(Inf, 3.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(Double.POSITIVE_INFINITY, 3.5), 1.0);
-
-        Assert.assertEquals("pow(-2.0, 3.0) should be -8.0", -8.0, FastMath.pow(-2.0, 3.0), Precision.EPSILON);
-
-        Assert.assertTrue("pow(-2.0, 3.5) should be NaN", Double.isNaN(FastMath.pow(-2.0, 3.5)));
-
-        Assert.assertTrue("pow(NaN, -Infinity) should be NaN", Double.isNaN(FastMath.pow(Double.NaN, Double.NEGATIVE_INFINITY)));
-
-        Assert.assertEquals("pow(NaN, 0.0) should be 1.0", 1.0, FastMath.pow(Double.NaN, 0.0), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-Infinity, -Infinity) should be 0.0", 0.0, FastMath.pow(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-huge, -huge) should be 0.0", 0.0, FastMath.pow(-Double.MAX_VALUE, -Double.MAX_VALUE), Precision.EPSILON);
-
-        Assert.assertTrue("pow(-huge,  huge) should be +Inf", Double.isInfinite(FastMath.pow(-Double.MAX_VALUE, Double.MAX_VALUE)));
-
-        Assert.assertTrue("pow(NaN, -Infinity) should be NaN", Double.isNaN(FastMath.pow(Double.NaN, Double.NEGATIVE_INFINITY)));
-
-        Assert.assertEquals("pow(NaN, -0.0) should be 1.0", 1.0, FastMath.pow(Double.NaN, -0.0), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-Infinity, -Infinity) should be 0.0", 0.0, FastMath.pow(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-huge, -huge) should be 0.0", 0.0, FastMath.pow(-Double.MAX_VALUE, -Double.MAX_VALUE), Precision.EPSILON);
-
-        Assert.assertEquals("pow(-huge,  huge) should be +Inf", Double.POSITIVE_INFINITY, FastMath.pow(-Double.MAX_VALUE, Double.MAX_VALUE), 1.0);
+        assertEquals("pow(-1, 0) should be 1.0", 1.0, FastMath.pow(-1.0, 0.0), Precision.EPSILON);
+        assertEquals("pow(-1, -0) should be 1.0", 1.0, FastMath.pow(-1.0, -0.0), Precision.EPSILON);
+        assertEquals("pow(PI, 1.0) should be PI", FastMath.PI, FastMath.pow(FastMath.PI, 1.0), Precision.EPSILON);
+        assertEquals("pow(-PI, 1.0) should be -PI", -FastMath.PI, FastMath.pow(-FastMath.PI, 1.0), Precision.EPSILON);
+        assertTrue("pow(PI, NaN) should be NaN", Double.isNaN(FastMath.pow(Math.PI, Double.NaN)));
+        assertTrue("pow(NaN, PI) should be NaN", Double.isNaN(FastMath.pow(Double.NaN, Math.PI)));
+        assertEquals("pow(2.0, Infinity) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(2.0, Double.POSITIVE_INFINITY), 1.0);
+        assertEquals("pow(0.5, -Infinity) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(0.5, Double.NEGATIVE_INFINITY), 1.0);
+        assertEquals("pow(0.5, Infinity) should be 0.0", 0.0, FastMath.pow(0.5, Double.POSITIVE_INFINITY), Precision.EPSILON);
+        assertEquals("pow(2.0, -Infinity) should be 0.0", 0.0, FastMath.pow(2.0, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("pow(0.0, 0.5) should be 0.0", 0.0, FastMath.pow(0.0, 0.5), Precision.EPSILON);
+        assertEquals("pow(Infinity, -0.5) should be 0.0", 0.0, FastMath.pow(Double.POSITIVE_INFINITY, -0.5), Precision.EPSILON);
+        assertEquals("pow(0.0, -0.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(0.0, -0.5), 1.0);
+        assertEquals("pow(Inf, 0.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(Double.POSITIVE_INFINITY, 0.5), 1.0);
+        assertEquals("pow(-0.0, -3.0) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(-0.0, -3.0), 1.0);
+        assertEquals("pow(-0.0, Infinity) should be 0.0", 0.0, FastMath.pow(-0.0, Double.POSITIVE_INFINITY), Precision.EPSILON);
+        assertTrue("pow(-0.0, NaN) should be NaN", Double.isNaN(FastMath.pow(-0.0, Double.NaN)));
+        assertEquals("pow(-0.0, -tiny) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -Double.MIN_VALUE), 1.0);
+        assertEquals("pow(-0.0, -huge) should be Infinity", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -Double.MAX_VALUE), 1.0);
+        assertEquals("pow(-Inf, 3.0) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, 3.0), 1.0);
+        assertEquals("pow(-Inf, -3.0) should be -0.0", -0.0, FastMath.pow(Double.NEGATIVE_INFINITY, -3.0), EXACT);
+        assertEquals("pow(-0.0, -3.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -3.5), 1.0);
+        assertEquals("pow(Inf, 3.5) should be Inf", Double.POSITIVE_INFINITY, FastMath.pow(Double.POSITIVE_INFINITY, 3.5), 1.0);
+        assertEquals("pow(-2.0, 3.0) should be -8.0", -8.0, FastMath.pow(-2.0, 3.0), Precision.EPSILON);
+        assertTrue("pow(-2.0, 3.5) should be NaN", Double.isNaN(FastMath.pow(-2.0, 3.5)));
+        assertTrue("pow(NaN, -Infinity) should be NaN", Double.isNaN(FastMath.pow(Double.NaN, Double.NEGATIVE_INFINITY)));
+        assertEquals("pow(NaN, 0.0) should be 1.0", 1.0, FastMath.pow(Double.NaN, 0.0), Precision.EPSILON);
+        assertEquals("pow(-Infinity, -Infinity) should be 0.0", 0.0, FastMath.pow(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("pow(-huge, -huge) should be 0.0", 0.0, FastMath.pow(-Double.MAX_VALUE, -Double.MAX_VALUE), Precision.EPSILON);
+        assertTrue("pow(-huge,  huge) should be +Inf", Double.isInfinite(FastMath.pow(-Double.MAX_VALUE, Double.MAX_VALUE)));
+        assertTrue("pow(NaN, -Infinity) should be NaN", Double.isNaN(FastMath.pow(Double.NaN, Double.NEGATIVE_INFINITY)));
+        assertEquals("pow(NaN, -0.0) should be 1.0", 1.0, FastMath.pow(Double.NaN, -0.0), Precision.EPSILON);
+        assertEquals("pow(-Infinity, -Infinity) should be 0.0", 0.0, FastMath.pow(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("pow(-huge, -huge) should be 0.0", 0.0, FastMath.pow(-Double.MAX_VALUE, -Double.MAX_VALUE), Precision.EPSILON);
+        assertEquals("pow(-huge,  huge) should be +Inf", Double.POSITIVE_INFINITY, FastMath.pow(-Double.MAX_VALUE, Double.MAX_VALUE), 1.0);
 
         // Added tests for a 100% coverage
 
-        Assert.assertTrue("pow(+Inf, NaN) should be NaN", Double.isNaN(FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN)));
-
-        Assert.assertTrue("pow(1.0, +Inf) should be NaN", Double.isNaN(FastMath.pow(1.0, Double.POSITIVE_INFINITY)));
-
-        Assert.assertTrue("pow(-Inf, NaN) should be NaN", Double.isNaN(FastMath.pow(Double.NEGATIVE_INFINITY, Double.NaN)));
-
-        Assert.assertEquals("pow(-Inf, -1.0) should be -0.0", -0.0, FastMath.pow(Double.NEGATIVE_INFINITY, -1.0), EXACT);
-
-        Assert.assertEquals("pow(-Inf, -2.0) should be 0.0", 0.0, FastMath.pow(Double.NEGATIVE_INFINITY, -2.0), EXACT);
-
-        Assert.assertEquals("pow(-Inf, 1.0) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, 1.0), 1.0);
-
-        Assert.assertEquals("pow(-Inf, 2.0) should be +Inf", Double.POSITIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, 2.0), 1.0);
-
-        Assert.assertTrue("pow(1.0, -Inf) should be NaN", Double.isNaN(FastMath.pow(1.0, Double.NEGATIVE_INFINITY)));
-
-        Assert.assertEquals("pow(-0.0, 1.0) should be -0.0", -0.0, FastMath.pow(-0.0, 1.0), EXACT);
-
-        Assert.assertEquals("pow(0.0, 1.0) should be 0.0", 0.0, FastMath.pow(0.0, 1.0), EXACT);
-
-        Assert.assertEquals("pow(0.0, +Inf) should be 0.0", 0.0, FastMath.pow(0.0, Double.POSITIVE_INFINITY), EXACT);
-
-        Assert.assertEquals("pow(-0.0, even) should be 0.0", 0.0, FastMath.pow(-0.0, 6.0), EXACT);
-
-        Assert.assertEquals("pow(-0.0, odd) should be -0.0", -0.0, FastMath.pow(-0.0, 13.0), EXACT);
-
-        Assert.assertEquals("pow(-0.0, -even) should be +Inf", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -6.0), EXACT);
-
-        Assert.assertEquals("pow(-0.0, -odd) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(-0.0, -13.0), EXACT);
-
-        Assert.assertEquals("pow(-2.0, 4.0) should be 16.0", 16.0, FastMath.pow(-2.0, 4.0), EXACT);
-
-        Assert.assertEquals("pow(-2.0, 4.5) should be NaN", Double.NaN, FastMath.pow(-2.0, 4.5), EXACT);
-
-        Assert.assertEquals("pow(-0.0, -0.0) should be 1.0", 1.0, FastMath.pow(-0.0, -0.0), EXACT);
-
-        Assert.assertEquals("pow(-0.0, 0.0) should be 1.0", 1.0, FastMath.pow(-0.0, 0.0), EXACT);
-
-        Assert.assertEquals("pow(0.0, -0.0) should be 1.0", 1.0, FastMath.pow(0.0, -0.0), EXACT);
-
-        Assert.assertEquals("pow(0.0, 0.0) should be 1.0", 1.0, FastMath.pow(0.0, 0.0), EXACT);
-
+        assertTrue("pow(+Inf, NaN) should be NaN", Double.isNaN(FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN)));
+        assertTrue("pow(1.0, +Inf) should be NaN", Double.isNaN(FastMath.pow(1.0, Double.POSITIVE_INFINITY)));
+        assertTrue("pow(-Inf, NaN) should be NaN", Double.isNaN(FastMath.pow(Double.NEGATIVE_INFINITY, Double.NaN)));
+        assertEquals("pow(-Inf, -1.0) should be -0.0", -0.0, FastMath.pow(Double.NEGATIVE_INFINITY, -1.0), EXACT);
+        assertEquals("pow(-Inf, -2.0) should be 0.0", 0.0, FastMath.pow(Double.NEGATIVE_INFINITY, -2.0), EXACT);
+        assertEquals("pow(-Inf, 1.0) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, 1.0), 1.0);
+        assertEquals("pow(-Inf, 2.0) should be +Inf", Double.POSITIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, 2.0), 1.0);
+        assertTrue("pow(1.0, -Inf) should be NaN", Double.isNaN(FastMath.pow(1.0, Double.NEGATIVE_INFINITY)));
+        assertEquals("pow(-0.0, 1.0) should be -0.0", -0.0, FastMath.pow(-0.0, 1.0), EXACT);
+        assertEquals("pow(0.0, 1.0) should be 0.0", 0.0, FastMath.pow(0.0, 1.0), EXACT);
+        assertEquals("pow(0.0, +Inf) should be 0.0", 0.0, FastMath.pow(0.0, Double.POSITIVE_INFINITY), EXACT);
+        assertEquals("pow(-0.0, even) should be 0.0", 0.0, FastMath.pow(-0.0, 6.0), EXACT);
+        assertEquals("pow(-0.0, odd) should be -0.0", -0.0, FastMath.pow(-0.0, 13.0), EXACT);
+        assertEquals("pow(-0.0, -even) should be +Inf", Double.POSITIVE_INFINITY, FastMath.pow(-0.0, -6.0), EXACT);
+        assertEquals("pow(-0.0, -odd) should be -Inf", Double.NEGATIVE_INFINITY, FastMath.pow(-0.0, -13.0), EXACT);
+        assertEquals("pow(-2.0, 4.0) should be 16.0", 16.0, FastMath.pow(-2.0, 4.0), EXACT);
+        assertEquals("pow(-2.0, 4.5) should be NaN", Double.NaN, FastMath.pow(-2.0, 4.5), EXACT);
+        assertEquals("pow(-0.0, -0.0) should be 1.0", 1.0, FastMath.pow(-0.0, -0.0), EXACT);
+        assertEquals("pow(-0.0, 0.0) should be 1.0", 1.0, FastMath.pow(-0.0, 0.0), EXACT);
+        assertEquals("pow(0.0, -0.0) should be 1.0", 1.0, FastMath.pow(0.0, -0.0), EXACT);
+        assertEquals("pow(0.0, 0.0) should be 1.0", 1.0, FastMath.pow(0.0, 0.0), EXACT);
     }
 
     @Test(timeout=20000L)
     public void testPowAllSpecialCases() {
         final double EXACT = -1.0;
-        final double DOUBLES[] = new double[]{Double.NEGATIVE_INFINITY, -0.0, Double.NaN, 0.0, Double.POSITIVE_INFINITY,
-                                              Long.MIN_VALUE, Integer.MIN_VALUE, Short.MIN_VALUE, Byte.MIN_VALUE,
-                                              -(double)Long.MIN_VALUE, -(double)Integer.MIN_VALUE, -(double)Short.MIN_VALUE, -(double)Byte.MIN_VALUE,
-                                              Byte.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE,
-                                              -Byte.MAX_VALUE, -Short.MAX_VALUE, -Integer.MAX_VALUE, -Long.MAX_VALUE,
-                                              Float.MAX_VALUE, Double.MAX_VALUE, Double.MIN_VALUE, Float.MIN_VALUE,
-                                              -Float.MAX_VALUE, -Double.MAX_VALUE, -Double.MIN_VALUE, -Float.MIN_VALUE,
-                                              0.5, 0.1, 0.2, 0.8, 1.1, 1.2, 1.5, 1.8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 1.3, 2.2, 2.5, 2.8, 33.0, 33.1, 33.5, 33.8, 10.0, 300.0, 400.0, 500.0,
-                                              -0.5, -0.1, -0.2, -0.8, -1.1, -1.2, -1.5, -1.8, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0, -1.3, -2.2, -2.5, -2.8, -33.0, -33.1, -33.5, -33.8, -10.0, -300.0, -400.0, -500.0};
+        final double DOUBLES[] = new double[]
+            {
+                Double.NEGATIVE_INFINITY, -0.0, Double.NaN, 0.0, Double.POSITIVE_INFINITY,
+                Long.MIN_VALUE, Integer.MIN_VALUE, Short.MIN_VALUE, Byte.MIN_VALUE,
+                -(double)Long.MIN_VALUE, -(double)Integer.MIN_VALUE, -(double)Short.MIN_VALUE, -(double)Byte.MIN_VALUE,
+                Byte.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE,
+                -Byte.MAX_VALUE, -Short.MAX_VALUE, -Integer.MAX_VALUE, -Long.MAX_VALUE,
+                Float.MAX_VALUE, Double.MAX_VALUE, Double.MIN_VALUE, Float.MIN_VALUE,
+                -Float.MAX_VALUE, -Double.MAX_VALUE, -Double.MIN_VALUE, -Float.MIN_VALUE,
+                0.5, 0.1, 0.2, 0.8, 1.1, 1.2, 1.5, 1.8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 1.3, 2.2, 2.5, 2.8, 33.0, 33.1, 33.5, 33.8, 10.0, 300.0, 400.0, 500.0,
+                -0.5, -0.1, -0.2, -0.8, -1.1, -1.2, -1.5, -1.8, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0, -1.3, -2.2, -2.5, -2.8, -33.0, -33.1, -33.5, -33.8, -10.0, -300.0, -400.0, -500.0
+            };
+
         // Special cases from Math.pow javadoc:
         // If the second argument is positive or negative zero, then the result is 1.0.
         for (double d : DOUBLES) {
-            Assert.assertEquals(1.0, FastMath.pow(d, 0.0), EXACT);
+            assertEquals(1.0, FastMath.pow(d, 0.0), EXACT);
         }
         for (double d : DOUBLES) {
-            Assert.assertEquals(1.0, FastMath.pow(d, -0.0), EXACT);
+            assertEquals(1.0, FastMath.pow(d, -0.0), EXACT);
         }
         // If the second argument is 1.0, then the result is the same as the first argument.
         for (double d : DOUBLES) {
-            Assert.assertEquals(d, FastMath.pow(d, 1.0), EXACT);
+            assertEquals(d, FastMath.pow(d, 1.0), EXACT);
         }
         // If the second argument is NaN, then the result is NaN.
         for (double d : DOUBLES) {
-            Assert.assertEquals(Double.NaN, FastMath.pow(d, Double.NaN), EXACT);
+            assertEquals(Double.NaN, FastMath.pow(d, Double.NaN), EXACT);
         }
         // If the first argument is NaN and the second argument is nonzero, then the result is NaN.
         for (double i : DOUBLES) {
             if (i != 0.0) {
-                Assert.assertEquals(Double.NaN, FastMath.pow(Double.NaN, i), EXACT);
+                assertEquals(Double.NaN, FastMath.pow(Double.NaN, i), EXACT);
             }
         }
         // If the absolute value of the first argument is greater than 1 and the second argument is positive infinity, or
         // the absolute value of the first argument is less than 1 and the second argument is negative infinity, then the result is positive infinity.
         for (double d : DOUBLES) {
             if (Math.abs(d) > 1.0) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Double.POSITIVE_INFINITY), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Double.POSITIVE_INFINITY), EXACT);
             }
         }
         for (double d : DOUBLES) {
             if (Math.abs(d) < 1.0) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Double.NEGATIVE_INFINITY), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Double.NEGATIVE_INFINITY), EXACT);
             }
         }
         // If the absolute value of the first argument is greater than 1 and the second argument is negative infinity, or
         // the absolute value of the first argument is less than 1 and the second argument is positive infinity, then the result is positive zero.
         for (double d : DOUBLES) {
             if (Math.abs(d) > 1.0) {
-                Assert.assertEquals(0.0, FastMath.pow(d, Double.NEGATIVE_INFINITY), EXACT);
+                assertEquals(0.0, FastMath.pow(d, Double.NEGATIVE_INFINITY), EXACT);
             }
         }
         for (double d : DOUBLES) {
             if (Math.abs(d) < 1.0) {
-                Assert.assertEquals(0.0, FastMath.pow(d, Double.POSITIVE_INFINITY), EXACT);
+                assertEquals(0.0, FastMath.pow(d, Double.POSITIVE_INFINITY), EXACT);
             }
         }
         // If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN.
-        Assert.assertEquals(Double.NaN, FastMath.pow(1.0, Double.POSITIVE_INFINITY), EXACT);
-        Assert.assertEquals(Double.NaN, FastMath.pow(1.0, Double.NEGATIVE_INFINITY), EXACT);
-        Assert.assertEquals(Double.NaN, FastMath.pow(-1.0, Double.POSITIVE_INFINITY), EXACT);
-        Assert.assertEquals(Double.NaN, FastMath.pow(-1.0, Double.NEGATIVE_INFINITY), EXACT);
+        assertEquals(Double.NaN, FastMath.pow(1.0, Double.POSITIVE_INFINITY), EXACT);
+        assertEquals(Double.NaN, FastMath.pow(1.0, Double.NEGATIVE_INFINITY), EXACT);
+        assertEquals(Double.NaN, FastMath.pow(-1.0, Double.POSITIVE_INFINITY), EXACT);
+        assertEquals(Double.NaN, FastMath.pow(-1.0, Double.NEGATIVE_INFINITY), EXACT);
         // If the first argument is positive zero and the second argument is greater than zero, or
         // the first argument is positive infinity and the second argument is less than zero, then the result is positive zero.
         for (double i : DOUBLES) {
             if (i > 0.0) {
-                Assert.assertEquals(0.0, FastMath.pow(0.0, i), EXACT);
+                assertEquals(0.0, FastMath.pow(0.0, i), EXACT);
             }
         }
         for (double i : DOUBLES) {
             if (i < 0.0) {
-                Assert.assertEquals(0.0, FastMath.pow(Double.POSITIVE_INFINITY, i), EXACT);
+                assertEquals(0.0, FastMath.pow(Double.POSITIVE_INFINITY, i), EXACT);
             }
         }
         // If the first argument is positive zero and the second argument is less than zero, or
         // the first argument is positive infinity and the second argument is greater than zero, then the result is positive infinity.
         for (double i : DOUBLES) {
             if (i < 0.0) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(0.0, i), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(0.0, i), EXACT);
             }
         }
         for (double i : DOUBLES) {
             if (i > 0.0) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(Double.POSITIVE_INFINITY, i), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(Double.POSITIVE_INFINITY, i), EXACT);
             }
         }
         // If the first argument is negative zero and the second argument is greater than zero but not a finite odd integer, or
         // the first argument is negative infinity and the second argument is less than zero but not a finite odd integer, then the result is positive zero.
         for (double i : DOUBLES) {
             if (i > 0.0 && (Double.isInfinite(i) || i % 2.0 == 0.0)) {
-                Assert.assertEquals(0.0, FastMath.pow(-0.0, i), EXACT);
+                assertEquals(0.0, FastMath.pow(-0.0, i), EXACT);
             }
         }
         for (double i : DOUBLES) {
             if (i < 0.0 && (Double.isInfinite(i) || i % 2.0 == 0.0)) {
-                Assert.assertEquals(0.0, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
+                assertEquals(0.0, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
             }
         }
         // If the first argument is negative zero and the second argument is a positive finite odd integer, or
         // the first argument is negative infinity and the second argument is a negative finite odd integer, then the result is negative zero.
         for (double i : DOUBLES) {
             if (i > 0.0 && i % 2.0 == 1.0) {
-                Assert.assertEquals(-0.0, FastMath.pow(-0.0, i), EXACT);
+                assertEquals(-0.0, FastMath.pow(-0.0, i), EXACT);
             }
         }
         for (double i : DOUBLES) {
             if (i < 0.0 && i % 2.0 == -1.0) {
-                Assert.assertEquals(-0.0, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
+                assertEquals(-0.0, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
             }
         }
         // If the first argument is negative zero and the second argument is less than zero but not a finite odd integer, or
         // the first argument is negative infinity and the second argument is greater than zero but not a finite odd integer, then the result is positive infinity.
         for (double i : DOUBLES) {
             if (i > 0.0 && (Double.isInfinite(i) || i % 2.0 == 0.0)) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
             }
         }
         for (double i : DOUBLES) {
             if (i < 0.0 && (Double.isInfinite(i) || i % 2.0 == 0.0)) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(-0.0, i), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(-0.0, i), EXACT);
             }
         }
         // If the first argument is negative zero and the second argument is a negative finite odd integer, or
         // the first argument is negative infinity and the second argument is a positive finite odd integer, then the result is negative infinity.
         for (double i : DOUBLES) {
             if (i > 0.0 && i % 2.0 == 1.0) {
-                Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
+                assertEquals(Double.NEGATIVE_INFINITY, FastMath.pow(Double.NEGATIVE_INFINITY, i), EXACT);
             }
         }
         for (double i : DOUBLES) {
             if (i < 0.0 && i % 2.0 == -1.0) {
-                Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.pow(-0.0, i), EXACT);
+                assertEquals(Double.NEGATIVE_INFINITY, FastMath.pow(-0.0, i), EXACT);
             }
         }
         for (double d : DOUBLES) {
@@ -622,11 +556,11 @@ public class FastMathTest {
                 for (double i : DOUBLES) {
                     if (Math.abs(i) <= Double.MAX_VALUE) {
                         // if the second argument is a finite even integer, the result is equal to the result of raising the absolute value of the first argument to the power of the second argument
-                        if (i % 2.0 == 0.0) Assert.assertEquals(FastMath.pow(-d, i), FastMath.pow(d, i), EXACT);
+                        if (i % 2.0 == 0.0) assertEquals(FastMath.pow(-d, i), FastMath.pow(d, i), EXACT);
                         // if the second argument is a finite odd integer, the result is equal to the negative of the result of raising the absolute value of the first argument to the power of the second argument
-                        else if (Math.abs(i) % 2.0 == 1.0) Assert.assertEquals(-FastMath.pow(-d, i), FastMath.pow(d, i), EXACT);
+                        else if (Math.abs(i) % 2.0 == 1.0) assertEquals(-FastMath.pow(-d, i), FastMath.pow(d, i), EXACT);
                         // if the second argument is finite and not an integer, then the result is NaN.
-                        else Assert.assertEquals(Double.NaN, FastMath.pow(d, i), EXACT);
+                        else assertEquals(Double.NaN, FastMath.pow(d, i), EXACT);
                     }
                 }
             }
@@ -658,7 +592,7 @@ public class FastMathTest {
                         if (dNegative && bi.testBit( 0 )) {
                             expected = -expected;
                         }
-                        Assert.assertEquals(d + "^" + i + "=" + expected + ", Math.pow=" + Math.pow(d, i), expected, FastMath.pow(d, i), expected == 0.0 || Double.isInfinite(expected) || Double.isNaN(expected) ? EXACT : 2.0 * Math.ulp(expected));
+                        assertEquals(d + "^" + i + "=" + expected + ", Math.pow=" + Math.pow(d, i), expected, FastMath.pow(d, i), expected == 0.0 || Double.isInfinite(expected) || Double.isNaN(expected) ? EXACT : 2.0 * Math.ulp(expected));
                     }
                 }
             }
@@ -668,68 +602,45 @@ public class FastMathTest {
     @Test
     public void testPowLargeIntegralDouble() {
         double y = FastMath.scalb(1.0, 65);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(FastMath.nextUp(1.0), y),    1.0);
-        Assert.assertEquals(1.0,                      FastMath.pow(1.0, y),                     1.0);
-        Assert.assertEquals(0.0,                      FastMath.pow(FastMath.nextDown(1.0), y),  1.0);
-        Assert.assertEquals(0.0,                      FastMath.pow(FastMath.nextUp(-1.0), y),   1.0);
-        Assert.assertEquals(1.0,                      FastMath.pow(-1.0, y),                    1.0);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(FastMath.nextDown(-1.0), y), 1.0);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(FastMath.nextUp(1.0), y),    1.0);
+        assertEquals(1.0,                      FastMath.pow(1.0, y),                     1.0);
+        assertEquals(0.0,                      FastMath.pow(FastMath.nextDown(1.0), y),  1.0);
+        assertEquals(0.0,                      FastMath.pow(FastMath.nextUp(-1.0), y),   1.0);
+        assertEquals(1.0,                      FastMath.pow(-1.0, y),                    1.0);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(FastMath.nextDown(-1.0), y), 1.0);
     }
 
     @Test
     public void testAtan2SpecialCases() {
 
-        Assert.assertTrue("atan2(NaN, 0.0) should be NaN", Double.isNaN(FastMath.atan2(Double.NaN, 0.0)));
-
-        Assert.assertTrue("atan2(0.0, NaN) should be NaN", Double.isNaN(FastMath.atan2(0.0, Double.NaN)));
-
-        Assert.assertEquals("atan2(0.0, 0.0) should be 0.0", 0.0, FastMath.atan2(0.0, 0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.0, 0.001) should be 0.0", 0.0, FastMath.atan2(0.0, 0.001), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.1, +Inf) should be 0.0", 0.0, FastMath.atan2(0.1, Double.POSITIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-0.0, 0.0) should be -0.0", -0.0, FastMath.atan2(-0.0, 0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-0.0, 0.001) should be -0.0", -0.0, FastMath.atan2(-0.0, 0.001), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-0.0, +Inf) should be -0.0", -0.0, FastMath.atan2(-0.1, Double.POSITIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.0, -0.0) should be PI", FastMath.PI, FastMath.atan2(0.0, -0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.1, -Inf) should be PI", FastMath.PI, FastMath.atan2(0.1, Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-0.0, -0.0) should be -PI", -FastMath.PI, FastMath.atan2(-0.0, -0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.1, -Inf) should be -PI", -FastMath.PI, FastMath.atan2(-0.1, Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.1, 0.0) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(0.1, 0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(0.1, -0.0) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(0.1, -0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(Inf, 0.1) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(Double.POSITIVE_INFINITY, 0.1), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(Inf, -0.1) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(Double.POSITIVE_INFINITY, -0.1), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-0.1, 0.0) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(-0.1, 0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-0.1, -0.0) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(-0.1, -0.0), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-Inf, 0.1) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(Double.NEGATIVE_INFINITY, 0.1), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-Inf, -0.1) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(Double.NEGATIVE_INFINITY, -0.1), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(Inf, Inf) should be PI/4", FastMath.PI / 4.0, FastMath.atan2(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY),
-                Precision.EPSILON);
-
-        Assert.assertEquals("atan2(Inf, -Inf) should be PI * 3/4", FastMath.PI * 3.0 / 4.0,
-                FastMath.atan2(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-Inf, Inf) should be -PI/4", -FastMath.PI / 4.0, FastMath.atan2(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY),
-                Precision.EPSILON);
-
-        Assert.assertEquals("atan2(-Inf, -Inf) should be -PI * 3/4", - FastMath.PI * 3.0 / 4.0,
-                FastMath.atan2(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertTrue("atan2(NaN, 0.0) should be NaN", Double.isNaN(FastMath.atan2(Double.NaN, 0.0)));
+        assertTrue("atan2(0.0, NaN) should be NaN", Double.isNaN(FastMath.atan2(0.0, Double.NaN)));
+        assertEquals("atan2(0.0, 0.0) should be 0.0", 0.0, FastMath.atan2(0.0, 0.0), Precision.EPSILON);
+        assertEquals("atan2(0.0, 0.001) should be 0.0", 0.0, FastMath.atan2(0.0, 0.001), Precision.EPSILON);
+        assertEquals("atan2(0.1, +Inf) should be 0.0", 0.0, FastMath.atan2(0.1, Double.POSITIVE_INFINITY), Precision.EPSILON);
+        assertEquals("atan2(-0.0, 0.0) should be -0.0", -0.0, FastMath.atan2(-0.0, 0.0), Precision.EPSILON);
+        assertEquals("atan2(-0.0, 0.001) should be -0.0", -0.0, FastMath.atan2(-0.0, 0.001), Precision.EPSILON);
+        assertEquals("atan2(-0.0, +Inf) should be -0.0", -0.0, FastMath.atan2(-0.1, Double.POSITIVE_INFINITY), Precision.EPSILON);
+        assertEquals("atan2(0.0, -0.0) should be PI", FastMath.PI, FastMath.atan2(0.0, -0.0), Precision.EPSILON);
+        assertEquals("atan2(0.1, -Inf) should be PI", FastMath.PI, FastMath.atan2(0.1, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("atan2(-0.0, -0.0) should be -PI", -FastMath.PI, FastMath.atan2(-0.0, -0.0), Precision.EPSILON);
+        assertEquals("atan2(0.1, -Inf) should be -PI", -FastMath.PI, FastMath.atan2(-0.1, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("atan2(0.1, 0.0) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(0.1, 0.0), Precision.EPSILON);
+        assertEquals("atan2(0.1, -0.0) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(0.1, -0.0), Precision.EPSILON);
+        assertEquals("atan2(Inf, 0.1) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(Double.POSITIVE_INFINITY, 0.1), Precision.EPSILON);
+        assertEquals("atan2(Inf, -0.1) should be PI/2", FastMath.PI / 2.0, FastMath.atan2(Double.POSITIVE_INFINITY, -0.1), Precision.EPSILON);
+        assertEquals("atan2(-0.1, 0.0) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(-0.1, 0.0), Precision.EPSILON);
+        assertEquals("atan2(-0.1, -0.0) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(-0.1, -0.0), Precision.EPSILON);
+        assertEquals("atan2(-Inf, 0.1) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(Double.NEGATIVE_INFINITY, 0.1), Precision.EPSILON);
+        assertEquals("atan2(-Inf, -0.1) should be -PI/2", -FastMath.PI / 2.0, FastMath.atan2(Double.NEGATIVE_INFINITY, -0.1), Precision.EPSILON);
+        assertEquals("atan2(Inf, Inf) should be PI/4", FastMath.PI / 4.0, FastMath.atan2(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY),
+                     Precision.EPSILON);
+        assertEquals("atan2(Inf, -Inf) should be PI * 3/4", FastMath.PI * 3.0 / 4.0,
+                     FastMath.atan2(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
+        assertEquals("atan2(-Inf, Inf) should be -PI/4", -FastMath.PI / 4.0, FastMath.atan2(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY),
+                     Precision.EPSILON);
+        assertEquals("atan2(-Inf, -Inf) should be -PI * 3/4", - FastMath.PI * 3.0 / 4.0,
+                     FastMath.atan2(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY), Precision.EPSILON);
     }
 
     @Test
@@ -753,8 +664,7 @@ public class FastMathTest {
 
             if (err != 0) {
                 double ulp = Math.abs(ref -
-                                      Double.longBitsToDouble((Double
-                                          .doubleToLongBits(ref) ^ 1)));
+                                      Double.longBitsToDouble((Double.doubleToLongBits(ref) ^ 1)));
                 double errulp = field.newDfp(tst).subtract(DfpMath.pow(field.newDfp(x), field.newDfp(y))).divide(field.newDfp(ulp)).toDouble();
 //                System.out.println(x + "\t" + y + "\t" + tst + "\t" + ref + "\t" + err + "\t" + errulp);
 
@@ -762,7 +672,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("pow() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("pow() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -789,7 +699,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("exp() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("exp() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -818,7 +728,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("sin() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("sin() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -847,7 +757,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("cos() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("cos() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -876,7 +786,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("tan() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("tan() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -907,7 +817,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("atan() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("atan() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -923,8 +833,7 @@ public class FastMathTest {
             // double x = ((generator.nextDouble() * 2.0) - 1.0) * generator.nextDouble();
             /* double x = 3.0 / 512.0 * i - 3.0; */
             double tst = FastMath.atan2(y, x);
-            Dfp refdfp = DfpMath.atan(field.newDfp(y)
-                .divide(field.newDfp(x)));
+            Dfp refdfp = DfpMath.atan(field.newDfp(y).divide(field.newDfp(x)));
             /* Make adjustments for sign */
             if (x < 0.0) {
                 if (y > 0.0)
@@ -938,8 +847,7 @@ public class FastMathTest {
 
             if (err != 0) {
                 double ulp = Math.abs(ref -
-                                      Double.longBitsToDouble((Double
-                                          .doubleToLongBits(ref) ^ 1)));
+                                      Double.longBitsToDouble((Double.doubleToLongBits(ref) ^ 1)));
                 double errulp = field.newDfp(tst).subtract(refdfp).divide(field.newDfp(ulp)).toDouble();
 //                System.out.println(x + "\t" + y + "\t" + tst + "\t" + ref + "\t" + errulp);
 
@@ -947,7 +855,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("atan2() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("atan2() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -965,8 +873,7 @@ public class FastMathTest {
 
             if (err != 0) {
                 double ulp = Math.abs(ref -
-                                      Double.longBitsToDouble((Double
-                                          .doubleToLongBits(ref) ^ 1)));
+                                      Double.longBitsToDouble((Double.doubleToLongBits(ref) ^ 1)));
                 double errulp = field.newDfp(tst).subtract(DfpMath.exp(field.newDfp(x)).subtract(field.getOne())).divide(field.newDfp(ulp)).toDouble();
 //                System.out.println(x + "\t" + tst + "\t" + ref + "\t" + err + "\t" + errulp);
 
@@ -974,7 +881,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("expm1() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("expm1() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -997,7 +904,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("asin() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("asin() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -1020,7 +927,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("acos() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("acos() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     /**
@@ -1029,17 +936,12 @@ public class FastMathTest {
     @Test
     public void testAcosSpecialCases() {
 
-        Assert.assertTrue("acos(NaN) should be NaN", Double.isNaN(FastMath.acos(Double.NaN)));
-
-        Assert.assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(-1.1)));
-
-        Assert.assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(1.1)));
-
-        Assert.assertEquals("acos(-1.0) should be PI", FastMath.acos(-1.0), FastMath.PI, Precision.EPSILON);
-
-        Assert.assertEquals("acos(1.0) should be 0.0", FastMath.acos(1.0), 0.0, Precision.EPSILON);
-
-        Assert.assertEquals("acos(0.0) should be PI/2", FastMath.acos(0.0), FastMath.PI / 2.0, Precision.EPSILON);
+        assertTrue("acos(NaN) should be NaN", Double.isNaN(FastMath.acos(Double.NaN)));
+        assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(-1.1)));
+        assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(1.1)));
+        assertEquals("acos(-1.0) should be PI", FastMath.acos(-1.0), FastMath.PI, Precision.EPSILON);
+        assertEquals("acos(1.0) should be 0.0", FastMath.acos(1.0), 0.0, Precision.EPSILON);
+        assertEquals("acos(0.0) should be PI/2", FastMath.acos(0.0), FastMath.PI / 2.0, Precision.EPSILON);
     }
 
     /**
@@ -1048,17 +950,12 @@ public class FastMathTest {
     @Test
     public void testAsinSpecialCases() {
 
-        Assert.assertTrue("asin(NaN) should be NaN", Double.isNaN(FastMath.asin(Double.NaN)));
-
-        Assert.assertTrue("asin(1.1) should be NaN", Double.isNaN(FastMath.asin(1.1)));
-
-        Assert.assertTrue("asin(-1.1) should be NaN", Double.isNaN(FastMath.asin(-1.1)));
-
-        Assert.assertEquals("asin(1.0) should be PI/2", FastMath.asin(1.0), FastMath.PI / 2.0, Precision.EPSILON);
-
-        Assert.assertEquals("asin(-1.0) should be -PI/2", FastMath.asin(-1.0), -FastMath.PI / 2.0, Precision.EPSILON);
-
-        Assert.assertEquals("asin(0.0) should be 0.0", FastMath.asin(0.0), 0.0, Precision.EPSILON);
+        assertTrue("asin(NaN) should be NaN", Double.isNaN(FastMath.asin(Double.NaN)));
+        assertTrue("asin(1.1) should be NaN", Double.isNaN(FastMath.asin(1.1)));
+        assertTrue("asin(-1.1) should be NaN", Double.isNaN(FastMath.asin(-1.1)));
+        assertEquals("asin(1.0) should be PI/2", FastMath.asin(1.0), FastMath.PI / 2.0, Precision.EPSILON);
+        assertEquals("asin(-1.0) should be -PI/2", FastMath.asin(-1.0), -FastMath.PI / 2.0, Precision.EPSILON);
+        assertEquals("asin(0.0) should be 0.0", FastMath.asin(0.0), 0.0, Precision.EPSILON);
     }
 
     private Dfp cosh(Dfp x) {
@@ -1092,7 +989,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("sinh() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("sinh() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -1114,7 +1011,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("cosh() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("cosh() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -1136,7 +1033,7 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("tanh() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("tanh() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -1158,24 +1055,24 @@ public class FastMathTest {
             }
         }
 
-        Assert.assertTrue("cbrt() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
+        assertTrue("cbrt() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     private Dfp cbrt(Dfp x) {
-      boolean negative=false;
+        boolean negative=false;
 
-      if (x.lessThan(field.getZero())) {
-          negative = true;
-          x = x.negate();
-      }
+        if (x.lessThan(field.getZero())) {
+            negative = true;
+            x = x.negate();
+        }
 
-      Dfp y = DfpMath.pow(x, field.getOne().divide(3));
+        Dfp y = DfpMath.pow(x, field.getOne().divide(3));
 
-      if (negative) {
-          y = y.negate();
-      }
+        if (negative) {
+            y = y.negate();
+        }
 
-      return y;
+        return y;
     }
 
     @Test
@@ -1196,8 +1093,7 @@ public class FastMathTest {
                 maxerrulp = Math.max(maxerrulp, Math.abs(errulp));
             }
         }
-        Assert.assertTrue("toDegrees() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
-
+        assertTrue("toDegrees() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
@@ -1211,148 +1107,147 @@ public class FastMathTest {
 
             if (err != 0) {
                 double ulp = Math.abs(ref -
-                                      Double.longBitsToDouble((Double
-                                          .doubleToLongBits(ref) ^ 1)));
+                                      Double.longBitsToDouble((Double.doubleToLongBits(ref) ^ 1)));
                 double errulp = field.newDfp(tst).subtract(DfpMath.exp(field.newDfp(x)).subtract(field.getOne())).divide(field.newDfp(ulp)).toDouble();
 //                System.out.println(x + "\t" + tst + "\t" + ref + "\t" + err + "\t" + errulp);
 
                 maxerrulp = Math.max(maxerrulp, Math.abs(errulp));
             }
         }
-        Assert.assertTrue("toRadians() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
 
+        assertTrue("toRadians() had errors in excess of " + MAX_ERROR_ULP + " ULP", maxerrulp < MAX_ERROR_ULP);
     }
 
     @Test
     public void testNextAfter() {
         // 0x402fffffffffffff 0x404123456789abcd -> 4030000000000000
-        Assert.assertEquals(16.0, FastMath.nextUp(15.999999999999998), 0.0);
+        assertEquals(16.0, FastMath.nextUp(15.999999999999998), 0.0);
 
         // 0xc02fffffffffffff 0x404123456789abcd -> c02ffffffffffffe
-        Assert.assertEquals(-15.999999999999996, FastMath.nextAfter(-15.999999999999998, 34.27555555555555), 0.0);
+        assertEquals(-15.999999999999996, FastMath.nextAfter(-15.999999999999998, 34.27555555555555), 0.0);
 
         // 0x402fffffffffffff 0x400123456789abcd -> 402ffffffffffffe
-        Assert.assertEquals(15.999999999999996, FastMath.nextDown(15.999999999999998), 0.0);
+        assertEquals(15.999999999999996, FastMath.nextDown(15.999999999999998), 0.0);
 
         // 0xc02fffffffffffff 0x400123456789abcd -> c02ffffffffffffe
-        Assert.assertEquals(-15.999999999999996, FastMath.nextAfter(-15.999999999999998, 2.142222222222222), 0.0);
+        assertEquals(-15.999999999999996, FastMath.nextAfter(-15.999999999999998, 2.142222222222222), 0.0);
 
         // 0x4020000000000000 0x404123456789abcd -> 4020000000000001
-        Assert.assertEquals(8.000000000000002, FastMath.nextAfter(8.0, 34.27555555555555), 0.0);
+        assertEquals(8.000000000000002, FastMath.nextAfter(8.0, 34.27555555555555), 0.0);
 
         // 0xc020000000000000 0x404123456789abcd -> c01fffffffffffff
-        Assert.assertEquals(-7.999999999999999, FastMath.nextAfter(-8.0, 34.27555555555555), 0.0);
+        assertEquals(-7.999999999999999, FastMath.nextAfter(-8.0, 34.27555555555555), 0.0);
 
         // 0x4020000000000000 0x400123456789abcd -> 401fffffffffffff
-        Assert.assertEquals(7.999999999999999, FastMath.nextAfter(8.0, 2.142222222222222), 0.0);
+        assertEquals(7.999999999999999, FastMath.nextAfter(8.0, 2.142222222222222), 0.0);
 
         // 0xc020000000000000 0x400123456789abcd -> c01fffffffffffff
-        Assert.assertEquals(-7.999999999999999, FastMath.nextAfter(-8.0, 2.142222222222222), 0.0);
+        assertEquals(-7.999999999999999, FastMath.nextAfter(-8.0, 2.142222222222222), 0.0);
 
         // 0x3f2e43753d36a223 0x3f2e43753d36a224 -> 3f2e43753d36a224
-        Assert.assertEquals(2.308922399667661E-4, FastMath.nextAfter(2.3089223996676606E-4, 2.308922399667661E-4), 0.0);
+        assertEquals(2.308922399667661E-4, FastMath.nextAfter(2.3089223996676606E-4, 2.308922399667661E-4), 0.0);
 
         // 0x3f2e43753d36a223 0x3f2e43753d36a223 -> 3f2e43753d36a223
-        Assert.assertEquals(2.3089223996676606E-4, FastMath.nextAfter(2.3089223996676606E-4, 2.3089223996676606E-4), 0.0);
+        assertEquals(2.3089223996676606E-4, FastMath.nextAfter(2.3089223996676606E-4, 2.3089223996676606E-4), 0.0);
 
         // 0x3f2e43753d36a223 0x3f2e43753d36a222 -> 3f2e43753d36a222
-        Assert.assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, 2.3089223996676603E-4), 0.0);
+        assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, 2.3089223996676603E-4), 0.0);
 
         // 0x3f2e43753d36a223 0xbf2e43753d36a224 -> 3f2e43753d36a222
-        Assert.assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, -2.308922399667661E-4), 0.0);
+        assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, -2.308922399667661E-4), 0.0);
 
         // 0x3f2e43753d36a223 0xbf2e43753d36a223 -> 3f2e43753d36a222
-        Assert.assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, -2.3089223996676606E-4), 0.0);
+        assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, -2.3089223996676606E-4), 0.0);
 
         // 0x3f2e43753d36a223 0xbf2e43753d36a222 -> 3f2e43753d36a222
-        Assert.assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, -2.3089223996676603E-4), 0.0);
+        assertEquals(2.3089223996676603E-4, FastMath.nextAfter(2.3089223996676606E-4, -2.3089223996676603E-4), 0.0);
 
         // 0xbf2e43753d36a223 0x3f2e43753d36a224 -> bf2e43753d36a222
-        Assert.assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, 2.308922399667661E-4), 0.0);
+        assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, 2.308922399667661E-4), 0.0);
 
         // 0xbf2e43753d36a223 0x3f2e43753d36a223 -> bf2e43753d36a222
-        Assert.assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, 2.3089223996676606E-4), 0.0);
+        assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, 2.3089223996676606E-4), 0.0);
 
         // 0xbf2e43753d36a223 0x3f2e43753d36a222 -> bf2e43753d36a222
-        Assert.assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, 2.3089223996676603E-4), 0.0);
+        assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, 2.3089223996676603E-4), 0.0);
 
         // 0xbf2e43753d36a223 0xbf2e43753d36a224 -> bf2e43753d36a224
-        Assert.assertEquals(-2.308922399667661E-4, FastMath.nextAfter(-2.3089223996676606E-4, -2.308922399667661E-4), 0.0);
+        assertEquals(-2.308922399667661E-4, FastMath.nextAfter(-2.3089223996676606E-4, -2.308922399667661E-4), 0.0);
 
         // 0xbf2e43753d36a223 0xbf2e43753d36a223 -> bf2e43753d36a223
-        Assert.assertEquals(-2.3089223996676606E-4, FastMath.nextAfter(-2.3089223996676606E-4, -2.3089223996676606E-4), 0.0);
+        assertEquals(-2.3089223996676606E-4, FastMath.nextAfter(-2.3089223996676606E-4, -2.3089223996676606E-4), 0.0);
 
         // 0xbf2e43753d36a223 0xbf2e43753d36a222 -> bf2e43753d36a222
-        Assert.assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, -2.3089223996676603E-4), 0.0);
+        assertEquals(-2.3089223996676603E-4, FastMath.nextAfter(-2.3089223996676606E-4, -2.3089223996676603E-4), 0.0);
 
     }
 
     @Test
     public void testDoubleNextAfterSpecialCases() {
-        Assert.assertEquals(-Double.MAX_VALUE,FastMath.nextAfter(Double.NEGATIVE_INFINITY, 0D), 0D);
-        Assert.assertEquals(Double.MAX_VALUE,FastMath.nextAfter(Double.POSITIVE_INFINITY, 0D), 0D);
-        Assert.assertEquals(Double.NaN,FastMath.nextAfter(Double.NaN, 0D), 0D);
-        Assert.assertEquals(Double.POSITIVE_INFINITY,FastMath.nextAfter(Double.MAX_VALUE, Double.POSITIVE_INFINITY), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY,FastMath.nextAfter(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY), 0D);
-        Assert.assertEquals(Double.MIN_VALUE, FastMath.nextAfter(0D, 1D), 0D);
-        Assert.assertEquals(-Double.MIN_VALUE, FastMath.nextAfter(0D, -1D), 0D);
-        Assert.assertEquals(0D, FastMath.nextAfter(Double.MIN_VALUE, -1), 0D);
-        Assert.assertEquals(0D, FastMath.nextAfter(-Double.MIN_VALUE, 1), 0D);
+        assertEquals(-Double.MAX_VALUE,FastMath.nextAfter(Double.NEGATIVE_INFINITY, 0D), 0D);
+        assertEquals(Double.MAX_VALUE,FastMath.nextAfter(Double.POSITIVE_INFINITY, 0D), 0D);
+        assertEquals(Double.NaN,FastMath.nextAfter(Double.NaN, 0D), 0D);
+        assertEquals(Double.POSITIVE_INFINITY,FastMath.nextAfter(Double.MAX_VALUE, Double.POSITIVE_INFINITY), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY,FastMath.nextAfter(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY), 0D);
+        assertEquals(Double.MIN_VALUE, FastMath.nextAfter(0D, 1D), 0D);
+        assertEquals(-Double.MIN_VALUE, FastMath.nextAfter(0D, -1D), 0D);
+        assertEquals(0D, FastMath.nextAfter(Double.MIN_VALUE, -1), 0D);
+        assertEquals(0D, FastMath.nextAfter(-Double.MIN_VALUE, 1), 0D);
     }
 
     @Test
     public void testFloatNextAfterSpecialCases() {
-        Assert.assertEquals(-Float.MAX_VALUE,FastMath.nextAfter(Float.NEGATIVE_INFINITY, 0F), 0F);
-        Assert.assertEquals(Float.MAX_VALUE,FastMath.nextAfter(Float.POSITIVE_INFINITY, 0F), 0F);
-        Assert.assertEquals(Float.NaN,FastMath.nextAfter(Float.NaN, 0F), 0F);
-        Assert.assertEquals(Float.POSITIVE_INFINITY,FastMath.nextUp(Float.MAX_VALUE), 0F);
-        Assert.assertEquals(Float.NEGATIVE_INFINITY,FastMath.nextDown(-Float.MAX_VALUE), 0F);
-        Assert.assertEquals(Float.MIN_VALUE, FastMath.nextAfter(0F, 1F), 0F);
-        Assert.assertEquals(-Float.MIN_VALUE, FastMath.nextAfter(0F, -1F), 0F);
-        Assert.assertEquals(0F, FastMath.nextAfter(Float.MIN_VALUE, -1F), 0F);
-        Assert.assertEquals(0F, FastMath.nextAfter(-Float.MIN_VALUE, 1F), 0F);
+        assertEquals(-Float.MAX_VALUE, FastMath.nextAfter(Float.NEGATIVE_INFINITY, 0F), 0F);
+        assertEquals(Float.MAX_VALUE, FastMath.nextAfter(Float.POSITIVE_INFINITY, 0F), 0F);
+        assertEquals(Float.NaN, FastMath.nextAfter(Float.NaN, 0F), 0F);
+        assertEquals(Float.POSITIVE_INFINITY, FastMath.nextUp(Float.MAX_VALUE), 0F);
+        assertEquals(Float.NEGATIVE_INFINITY, FastMath.nextDown(-Float.MAX_VALUE), 0F);
+        assertEquals(Float.MIN_VALUE, FastMath.nextAfter(0F, 1F), 0F);
+        assertEquals(-Float.MIN_VALUE, FastMath.nextAfter(0F, -1F), 0F);
+        assertEquals(0F, FastMath.nextAfter(Float.MIN_VALUE, -1F), 0F);
+        assertEquals(0F, FastMath.nextAfter(-Float.MIN_VALUE, 1F), 0F);
     }
 
     @Test
     public void testDoubleScalbSpecialCases() {
-        Assert.assertEquals(2.5269841324701218E-175,  FastMath.scalb(2.2250738585072014E-308, 442), 0D);
-        Assert.assertEquals(1.307993905256674E297,    FastMath.scalb(1.1102230246251565E-16, 1040), 0D);
-        Assert.assertEquals(7.2520887996488946E-217,  FastMath.scalb(Double.MIN_VALUE,        356), 0D);
-        Assert.assertEquals(8.98846567431158E307,     FastMath.scalb(Double.MIN_VALUE,       2097), 0D);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb(Double.MIN_VALUE,       2098), 0D);
-        Assert.assertEquals(1.1125369292536007E-308,  FastMath.scalb(2.225073858507201E-308,   -1), 0D);
-        Assert.assertEquals(1.0E-323,                 FastMath.scalb(Double.MAX_VALUE,      -2097), 0D);
-        Assert.assertEquals(Double.MIN_VALUE,         FastMath.scalb(Double.MAX_VALUE,      -2098), 0D);
-        Assert.assertEquals(0,                        FastMath.scalb(Double.MAX_VALUE,      -2099), 0D);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb(Double.POSITIVE_INFINITY, -1000000), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.1102230246251565E-16, 1078), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.1102230246251565E-16,  1079), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-2.2250738585072014E-308, 2047), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-2.2250738585072014E-308, 2048), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.7976931348623157E308,  2147483647), 0D);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb( 1.7976931348623157E308,  2147483647), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.1102230246251565E-16,  2147483647), 0D);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb( 1.1102230246251565E-16,  2147483647), 0D);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-2.2250738585072014E-308, 2147483647), 0D);
-        Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb( 2.2250738585072014E-308, 2147483647), 0D);
+        assertEquals(2.5269841324701218E-175,  FastMath.scalb(2.2250738585072014E-308, 442), 0D);
+        assertEquals(1.307993905256674E297,    FastMath.scalb(1.1102230246251565E-16, 1040), 0D);
+        assertEquals(7.2520887996488946E-217,  FastMath.scalb(Double.MIN_VALUE,        356), 0D);
+        assertEquals(8.98846567431158E307,     FastMath.scalb(Double.MIN_VALUE,       2097), 0D);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb(Double.MIN_VALUE,       2098), 0D);
+        assertEquals(1.1125369292536007E-308,  FastMath.scalb(2.225073858507201E-308,   -1), 0D);
+        assertEquals(1.0E-323,                 FastMath.scalb(Double.MAX_VALUE,      -2097), 0D);
+        assertEquals(Double.MIN_VALUE,         FastMath.scalb(Double.MAX_VALUE,      -2098), 0D);
+        assertEquals(0,                        FastMath.scalb(Double.MAX_VALUE,      -2099), 0D);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb(Double.POSITIVE_INFINITY, -1000000), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.1102230246251565E-16, 1078), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.1102230246251565E-16,  1079), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-2.2250738585072014E-308, 2047), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-2.2250738585072014E-308, 2048), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.7976931348623157E308,  2147483647), 0D);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb( 1.7976931348623157E308,  2147483647), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-1.1102230246251565E-16,  2147483647), 0D);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb( 1.1102230246251565E-16,  2147483647), 0D);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.scalb(-2.2250738585072014E-308, 2147483647), 0D);
+        assertEquals(Double.POSITIVE_INFINITY, FastMath.scalb( 2.2250738585072014E-308, 2147483647), 0D);
     }
 
     @Test
     public void testFloatScalbSpecialCases() {
-        Assert.assertEquals(0f,                       FastMath.scalb(Float.MIN_VALUE,  -30), 0F);
-        Assert.assertEquals(2 * Float.MIN_VALUE,      FastMath.scalb(Float.MIN_VALUE,    1), 0F);
-        Assert.assertEquals(7.555786e22f,             FastMath.scalb(Float.MAX_VALUE,  -52), 0F);
-        Assert.assertEquals(1.7014118e38f,            FastMath.scalb(Float.MIN_VALUE,  276), 0F);
-        Assert.assertEquals(Float.POSITIVE_INFINITY,  FastMath.scalb(Float.MIN_VALUE,  277), 0F);
-        Assert.assertEquals(5.8774718e-39f,           FastMath.scalb(1.1754944e-38f,    -1), 0F);
-        Assert.assertEquals(2 * Float.MIN_VALUE,      FastMath.scalb(Float.MAX_VALUE, -276), 0F);
-        Assert.assertEquals(Float.MIN_VALUE,          FastMath.scalb(Float.MAX_VALUE, -277), 0F);
-        Assert.assertEquals(0,                        FastMath.scalb(Float.MAX_VALUE, -278), 0F);
-        Assert.assertEquals(Float.POSITIVE_INFINITY,  FastMath.scalb(Float.POSITIVE_INFINITY, -1000000), 0F);
-        Assert.assertEquals(-3.13994498e38f,          FastMath.scalb(-1.1e-7f,         151), 0F);
-        Assert.assertEquals(Float.NEGATIVE_INFINITY,  FastMath.scalb(-1.1e-7f,         152), 0F);
-        Assert.assertEquals(Float.POSITIVE_INFINITY,  FastMath.scalb(3.4028235E38f,  2147483647), 0F);
-        Assert.assertEquals(Float.NEGATIVE_INFINITY,  FastMath.scalb(-3.4028235E38f, 2147483647), 0F);
+        assertEquals(0f, FastMath.scalb(Float.MIN_VALUE, -30), 0F);
+        assertEquals(2 * Float.MIN_VALUE, FastMath.scalb(Float.MIN_VALUE, 1), 0F);
+        assertEquals(7.555786e22f, FastMath.scalb(Float.MAX_VALUE, -52), 0F);
+        assertEquals(1.7014118e38f, FastMath.scalb(Float.MIN_VALUE, 276), 0F);
+        assertEquals(Float.POSITIVE_INFINITY, FastMath.scalb(Float.MIN_VALUE, 277), 0F);
+        assertEquals(5.8774718e-39f, FastMath.scalb(1.1754944e-38f, -1), 0F);
+        assertEquals(2 * Float.MIN_VALUE, FastMath.scalb(Float.MAX_VALUE, -276), 0F);
+        assertEquals(Float.MIN_VALUE, FastMath.scalb(Float.MAX_VALUE, -277), 0F);
+        assertEquals(0, FastMath.scalb(Float.MAX_VALUE, -278), 0F);
+        assertEquals(Float.POSITIVE_INFINITY, FastMath.scalb(Float.POSITIVE_INFINITY, -1000000), 0F);
+        assertEquals(-3.13994498e38f, FastMath.scalb(-1.1e-7f, 151), 0F);
+        assertEquals(Float.NEGATIVE_INFINITY, FastMath.scalb(-1.1e-7f, 152), 0F);
+        assertEquals(Float.POSITIVE_INFINITY, FastMath.scalb(3.4028235E38f, 2147483647), 0F);
+        assertEquals(Float.NEGATIVE_INFINITY, FastMath.scalb(-3.4028235E38f, 2147483647), 0F);
     }
 
     private boolean compareClassMethods(Class<?> class1, Class<?> class2){
@@ -1374,66 +1269,66 @@ public class FastMathTest {
     @Test
     public void checkMissingFastMathClasses() {
         boolean ok = compareClassMethods(StrictMath.class, FastMath.class);
-        Assert.assertTrue("FastMath should implement all StrictMath methods", ok);
+        assertTrue("FastMath should implement all StrictMath methods", ok);
     }
 
     @Ignore
     @Test
     public void checkExtraFastMathClasses() {
-        compareClassMethods( FastMath.class, StrictMath.class);
+        compareClassMethods(FastMath.class, StrictMath.class);
     }
 
     @Test
     public void testSignumDouble() {
         final double delta = 0.0;
-        Assert.assertEquals(1.0, FastMath.signum(2.0), delta);
-        Assert.assertEquals(0.0, FastMath.signum(0.0), delta);
-        Assert.assertEquals(-1.0, FastMath.signum(-2.0), delta);
+        assertEquals(1.0, FastMath.signum(2.0), delta);
+        assertEquals(0.0, FastMath.signum(0.0), delta);
+        assertEquals(-1.0, FastMath.signum(-2.0), delta);
         TestUtils.assertSame(-0. / 0., FastMath.signum(Double.NaN));
     }
 
     @Test
     public void testSignumFloat() {
         final float delta = 0.0F;
-        Assert.assertEquals(1.0F, FastMath.signum(2.0F), delta);
-        Assert.assertEquals(0.0F, FastMath.signum(0.0F), delta);
-        Assert.assertEquals(-1.0F, FastMath.signum(-2.0F), delta);
+        assertEquals(1.0F, FastMath.signum(2.0F), delta);
+        assertEquals(0.0F, FastMath.signum(0.0F), delta);
+        assertEquals(-1.0F, FastMath.signum(-2.0F), delta);
         TestUtils.assertSame(Float.NaN, FastMath.signum(Float.NaN));
     }
 
     @Test
     public void testLogWithBase() {
-        Assert.assertEquals(2.0, FastMath.log(2, 4), 0);
-        Assert.assertEquals(3.0, FastMath.log(2, 8), 0);
-        Assert.assertTrue(Double.isNaN(FastMath.log(-1, 1)));
-        Assert.assertTrue(Double.isNaN(FastMath.log(1, -1)));
-        Assert.assertTrue(Double.isNaN(FastMath.log(0, 0)));
-        Assert.assertEquals(0, FastMath.log(0, 10), 0);
-        Assert.assertEquals(Double.NEGATIVE_INFINITY, FastMath.log(10, 0), 0);
+        assertEquals(2.0, FastMath.log(2, 4), 0);
+        assertEquals(3.0, FastMath.log(2, 8), 0);
+        assertTrue(Double.isNaN(FastMath.log(-1, 1)));
+        assertTrue(Double.isNaN(FastMath.log(1, -1)));
+        assertTrue(Double.isNaN(FastMath.log(0, 0)));
+        assertEquals(0, FastMath.log(0, 10), 0);
+        assertEquals(Double.NEGATIVE_INFINITY, FastMath.log(10, 0), 0);
     }
 
     @Test
     public void testIndicatorDouble() {
         double delta = 0.0;
-        Assert.assertEquals(1.0, FastMath.copySign(1d, 2.0), delta);
-        Assert.assertEquals(1.0, FastMath.copySign(1d, 0.0), delta);
-        Assert.assertEquals(-1.0, FastMath.copySign(1d, -0.0), delta);
-        Assert.assertEquals(1.0, FastMath.copySign(1d, Double.POSITIVE_INFINITY), delta);
-        Assert.assertEquals(-1.0, FastMath.copySign(1d, Double.NEGATIVE_INFINITY), delta);
-        Assert.assertEquals(1.0, FastMath.copySign(1d, Double.NaN), delta);
-        Assert.assertEquals(-1.0, FastMath.copySign(1d, -2.0), delta);
+        assertEquals(1.0, FastMath.copySign(1d, 2.0), delta);
+        assertEquals(1.0, FastMath.copySign(1d, 0.0), delta);
+        assertEquals(-1.0, FastMath.copySign(1d, -0.0), delta);
+        assertEquals(1.0, FastMath.copySign(1d, Double.POSITIVE_INFINITY), delta);
+        assertEquals(-1.0, FastMath.copySign(1d, Double.NEGATIVE_INFINITY), delta);
+        assertEquals(1.0, FastMath.copySign(1d, Double.NaN), delta);
+        assertEquals(-1.0, FastMath.copySign(1d, -2.0), delta);
     }
 
     @Test
     public void testIndicatorFloat() {
         float delta = 0.0F;
-        Assert.assertEquals(1.0F, FastMath.copySign(1d, 2.0F), delta);
-        Assert.assertEquals(1.0F, FastMath.copySign(1d, 0.0F), delta);
-        Assert.assertEquals(-1.0F, FastMath.copySign(1d, -0.0F), delta);
-        Assert.assertEquals(1.0F, FastMath.copySign(1d, Float.POSITIVE_INFINITY), delta);
-        Assert.assertEquals(-1.0F, FastMath.copySign(1d, Float.NEGATIVE_INFINITY), delta);
-        Assert.assertEquals(1.0F, FastMath.copySign(1d, Float.NaN), delta);
-        Assert.assertEquals(-1.0F, FastMath.copySign(1d, -2.0F), delta);
+        assertEquals(1.0F, FastMath.copySign(1d, 2.0F), delta);
+        assertEquals(1.0F, FastMath.copySign(1d, 0.0F), delta);
+        assertEquals(-1.0F, FastMath.copySign(1d, -0.0F), delta);
+        assertEquals(1.0F, FastMath.copySign(1d, Float.POSITIVE_INFINITY), delta);
+        assertEquals(-1.0F, FastMath.copySign(1d, Float.NEGATIVE_INFINITY), delta);
+        assertEquals(1.0F, FastMath.copySign(1d, Float.NaN), delta);
+        assertEquals(-1.0F, FastMath.copySign(1d, -2.0F), delta);
     }
 
     @Test
@@ -1444,95 +1339,99 @@ public class FastMathTest {
         Dfp baseDfp = field.newDfp(base);
         Dfp dfpPower = field.getOne();
         for (int i = 0; i < maxExp; i++) {
-            Assert.assertEquals("exp=" + i, dfpPower.toDouble(), FastMath.pow(base, i),
-                                0.6 * FastMath.ulp(dfpPower.toDouble()));
+            assertEquals("exp=" + i, dfpPower.toDouble(), FastMath.pow(base, i),
+                         0.6 * FastMath.ulp(dfpPower.toDouble()));
             dfpPower = dfpPower.multiply(baseDfp);
         }
     }
 
     @Test
     public void testIntPowHuge() {
-        Assert.assertTrue(Double.isInfinite(FastMath.pow(FastMath.scalb(1.0, 500), 4)));
+        assertTrue(Double.isInfinite(FastMath.pow(FastMath.scalb(1.0, 500), 4)));
     }
 
     @Test(timeout=5000L) // This test must finish in finite time.
     public void testIntPowLongMinValue() {
-        Assert.assertEquals(1.0, FastMath.pow(1.0, Long.MIN_VALUE), -1.0);
+        assertEquals(1.0, FastMath.pow(1.0, Long.MIN_VALUE), -1.0);
     }
 
     @Test(timeout=5000L)
     public void testIntPowSpecialCases() {
         final double EXACT = -1.0;
-        final double DOUBLES[] = new double[]{Double.NEGATIVE_INFINITY, -0.0, Double.NaN, 0.0, Double.POSITIVE_INFINITY,
-                                              Long.MIN_VALUE, Integer.MIN_VALUE, Short.MIN_VALUE, Byte.MIN_VALUE,
-                                              -(double)Long.MIN_VALUE, -(double)Integer.MIN_VALUE, -(double)Short.MIN_VALUE, -(double)Byte.MIN_VALUE,
-                                              Byte.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE,
-                                              -Byte.MAX_VALUE, -Short.MAX_VALUE, -Integer.MAX_VALUE, -Long.MAX_VALUE,
-                                              Float.MAX_VALUE, Double.MAX_VALUE, Double.MIN_VALUE, Float.MIN_VALUE,
-                                              -Float.MAX_VALUE, -Double.MAX_VALUE, -Double.MIN_VALUE, -Float.MIN_VALUE,
-                                              0.5, 0.1, 0.2, 0.8, 1.1, 1.2, 1.5, 1.8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 1.3, 2.2, 2.5, 2.8, 33.0, 33.1, 33.5, 33.8, 10.0, 300.0, 400.0, 500.0,
-                                              -0.5, -0.1, -0.2, -0.8, -1.1, -1.2, -1.5, -1.8, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0, -1.3, -2.2, -2.5, -2.8, -33.0, -33.1, -33.5, -33.8, -10.0, -300.0, -400.0, -500.0};
+        final double DOUBLES[] = new double[]
+            {
+                Double.NEGATIVE_INFINITY, -0.0, Double.NaN, 0.0, Double.POSITIVE_INFINITY,
+                Long.MIN_VALUE, Integer.MIN_VALUE, Short.MIN_VALUE, Byte.MIN_VALUE,
+                -(double)Long.MIN_VALUE, -(double)Integer.MIN_VALUE, -(double)Short.MIN_VALUE, -(double)Byte.MIN_VALUE,
+                Byte.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE,
+                -Byte.MAX_VALUE, -Short.MAX_VALUE, -Integer.MAX_VALUE, -Long.MAX_VALUE,
+                Float.MAX_VALUE, Double.MAX_VALUE, Double.MIN_VALUE, Float.MIN_VALUE,
+                -Float.MAX_VALUE, -Double.MAX_VALUE, -Double.MIN_VALUE, -Float.MIN_VALUE,
+                0.5, 0.1, 0.2, 0.8, 1.1, 1.2, 1.5, 1.8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 1.3, 2.2, 2.5, 2.8, 33.0, 33.1, 33.5, 33.8, 10.0, 300.0, 400.0, 500.0,
+                -0.5, -0.1, -0.2, -0.8, -1.1, -1.2, -1.5, -1.8, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0, -1.3, -2.2, -2.5, -2.8, -33.0, -33.1, -33.5, -33.8, -10.0, -300.0, -400.0, -500.0
+            };
+
         final long INTS[] = new long[]{Long.MAX_VALUE, Long.MAX_VALUE - 1, Long.MIN_VALUE, Long.MIN_VALUE + 1, Long.MIN_VALUE + 2, Integer.MAX_VALUE, Integer.MAX_VALUE - 1, Integer.MIN_VALUE, Integer.MIN_VALUE + 1, Integer.MIN_VALUE + 2, 0, 1, 2, 3, 5, 8, 10, 20, 100, 300, 500, -1, -2, -3, -5, -8, -10, -20, -100, -300, -500};
         // Special cases from Math.pow javadoc:
         // If the second argument is positive or negative zero, then the result is 1.0.
         for (double d : DOUBLES) {
-            Assert.assertEquals(1.0, FastMath.pow(d, 0L), EXACT);
+            assertEquals(1.0, FastMath.pow(d, 0L), EXACT);
         }
         // If the second argument is 1.0, then the result is the same as the first argument.
         for (double d : DOUBLES) {
-            Assert.assertEquals(d, FastMath.pow(d, 1L), EXACT);
+            assertEquals(d, FastMath.pow(d, 1L), EXACT);
         }
         // If the second argument is NaN, then the result is NaN. <- Impossible with int.
         // If the first argument is NaN and the second argument is nonzero, then the result is NaN.
         for (long i : INTS) {
             if (i != 0L) {
-                Assert.assertEquals(Double.NaN, FastMath.pow(Double.NaN, i), EXACT);
+                assertEquals(Double.NaN, FastMath.pow(Double.NaN, i), EXACT);
             }
         }
         // If the absolute value of the first argument is greater than 1 and the second argument is positive infinity, or
         // the absolute value of the first argument is less than 1 and the second argument is negative infinity, then the result is positive infinity.
         for (double d : DOUBLES) {
             if (Math.abs(d) > 1.0) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Long.MAX_VALUE - 1L), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Long.MAX_VALUE - 1L), EXACT);
             }
         }
         for (double d : DOUBLES) {
             if (Math.abs(d) < 1.0) {
-                Assert.assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Long.MIN_VALUE), EXACT);
+                assertEquals(Double.POSITIVE_INFINITY, FastMath.pow(d, Long.MIN_VALUE), EXACT);
             }
         }
         // Note: Long.MAX_VALUE isn't actually an infinity, so its parity affects the sign of resulting infinity.
         for (double d : DOUBLES) {
             if (Math.abs(d) > 1.0) {
-                Assert.assertTrue(Double.isInfinite(FastMath.pow(d, Long.MAX_VALUE)));
+                assertTrue(Double.isInfinite(FastMath.pow

<TRUNCATED>

[2/7] [math] Renamed o.h.stat.inference.TestUtils to InferenceTestUtils

Posted by eb...@apache.org.
Renamed o.h.stat.inference.TestUtils to InferenceTestUtils


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/5c341d9d
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/5c341d9d
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/5c341d9d

Branch: refs/heads/develop
Commit: 5c341d9ded098fafcbed3ce88643e96286928011
Parents: dccc125
Author: Phil Steitz <ph...@gmail.com>
Authored: Fri Aug 5 14:25:35 2016 +0200
Committer: Emmanuel Bourg <eb...@apache.org>
Committed: Fri Aug 5 14:25:35 2016 +0200

----------------------------------------------------------------------
 .../stat/inference/InferenceTestUtils.java      | 547 ++++++++++++++++++
 .../commons/math4/stat/inference/TestUtils.java | 547 ------------------
 .../distribution/BetaDistributionTest.java      |   7 +-
 .../stat/inference/InferenceTestUtilsTest.java  | 557 ++++++++++++++++++
 .../math4/stat/inference/TestUtilsTest.java     | 559 -------------------
 5 files changed, 1107 insertions(+), 1110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/5c341d9d/src/main/java/org/apache/commons/math4/stat/inference/InferenceTestUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/InferenceTestUtils.java b/src/main/java/org/apache/commons/math4/stat/inference/InferenceTestUtils.java
new file mode 100644
index 0000000..a0da22f
--- /dev/null
+++ b/src/main/java/org/apache/commons/math4/stat/inference/InferenceTestUtils.java
@@ -0,0 +1,547 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math4.stat.inference;
+
+import java.util.Collection;
+
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+
+/**
+ * A collection of static methods to create inference test instances or to
+ * perform inference tests.
+ *
+ * @since 1.1
+ */
+public class InferenceTestUtils {
+
+    /** Singleton TTest instance. */
+    private static final TTest T_TEST = new TTest();
+
+    /** Singleton ChiSquareTest instance. */
+    private static final ChiSquareTest CHI_SQUARE_TEST = new ChiSquareTest();
+
+    /** Singleton OneWayAnova instance. */
+    private static final OneWayAnova ONE_WAY_ANANOVA = new OneWayAnova();
+
+    /** Singleton G-Test instance. */
+    private static final GTest G_TEST = new GTest();
+
+    /** Singleton K-S test instance */
+    private static final KolmogorovSmirnovTest KS_TEST = new KolmogorovSmirnovTest();
+
+    /**
+     * Prevent instantiation.
+     */
+    private InferenceTestUtils() {
+        super();
+    }
+
+    // CHECKSTYLE: stop JavadocMethodCheck
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticT(double[], double[])
+     */
+    public static double homoscedasticT(final double[] sample1, final double[] sample2)
+        throws NullArgumentException, NumberIsTooSmallException {
+        return T_TEST.homoscedasticT(sample1, sample2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticT(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
+     */
+    public static double homoscedasticT(final StatisticalSummary sampleStats1,
+                                        final StatisticalSummary sampleStats2)
+        throws NullArgumentException, NumberIsTooSmallException {
+        return T_TEST.homoscedasticT(sampleStats1, sampleStats2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(double[], double[], double)
+     */
+    public static boolean homoscedasticTTest(final double[] sample1, final double[] sample2,
+                                             final double alpha)
+        throws NullArgumentException, NumberIsTooSmallException,
+        OutOfRangeException, MaxCountExceededException {
+        return T_TEST.homoscedasticTTest(sample1, sample2, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(double[], double[])
+     */
+    public static double homoscedasticTTest(final double[] sample1, final double[] sample2)
+        throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException {
+        return T_TEST.homoscedasticTTest(sample1, sample2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
+     */
+    public static double homoscedasticTTest(final StatisticalSummary sampleStats1,
+                                            final StatisticalSummary sampleStats2)
+        throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException {
+        return T_TEST.homoscedasticTTest(sampleStats1, sampleStats2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#pairedT(double[], double[])
+     */
+    public static double pairedT(final double[] sample1, final double[] sample2)
+        throws NullArgumentException, NoDataException,
+        DimensionMismatchException, NumberIsTooSmallException {
+        return T_TEST.pairedT(sample1, sample2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#pairedTTest(double[], double[], double)
+     */
+    public static boolean pairedTTest(final double[] sample1, final double[] sample2,
+                                      final double alpha)
+        throws NullArgumentException, NoDataException, DimensionMismatchException,
+        NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException {
+        return T_TEST.pairedTTest(sample1, sample2, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#pairedTTest(double[], double[])
+     */
+    public static double pairedTTest(final double[] sample1, final double[] sample2)
+        throws NullArgumentException, NoDataException, DimensionMismatchException,
+        NumberIsTooSmallException, MaxCountExceededException {
+        return T_TEST.pairedTTest(sample1, sample2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#t(double, double[])
+     */
+    public static double t(final double mu, final double[] observed)
+        throws NullArgumentException, NumberIsTooSmallException {
+        return T_TEST.t(mu, observed);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#t(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
+     */
+    public static double t(final double mu, final StatisticalSummary sampleStats)
+        throws NullArgumentException, NumberIsTooSmallException {
+        return T_TEST.t(mu, sampleStats);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#t(double[], double[])
+     */
+    public static double t(final double[] sample1, final double[] sample2)
+        throws NullArgumentException, NumberIsTooSmallException {
+        return T_TEST.t(sample1, sample2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#t(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
+     */
+    public static double t(final StatisticalSummary sampleStats1,
+                           final StatisticalSummary sampleStats2)
+        throws NullArgumentException, NumberIsTooSmallException {
+        return T_TEST.t(sampleStats1, sampleStats2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, double[], double)
+     */
+    public static boolean tTest(final double mu, final double[] sample, final double alpha)
+        throws NullArgumentException, NumberIsTooSmallException,
+        OutOfRangeException, MaxCountExceededException {
+        return T_TEST.tTest(mu, sample, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, double[])
+     */
+    public static double tTest(final double mu, final double[] sample)
+        throws NullArgumentException, NumberIsTooSmallException,
+        MaxCountExceededException {
+        return T_TEST.tTest(mu, sample);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary, double)
+     */
+    public static boolean tTest(final double mu, final StatisticalSummary sampleStats,
+                                final double alpha)
+        throws NullArgumentException, NumberIsTooSmallException,
+        OutOfRangeException, MaxCountExceededException {
+        return T_TEST.tTest(mu, sampleStats, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
+     */
+    public static double tTest(final double mu, final StatisticalSummary sampleStats)
+        throws NullArgumentException, NumberIsTooSmallException,
+        MaxCountExceededException {
+        return T_TEST.tTest(mu, sampleStats);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double[], double[], double)
+     */
+    public static boolean tTest(final double[] sample1, final double[] sample2,
+                                final double alpha)
+        throws NullArgumentException, NumberIsTooSmallException,
+        OutOfRangeException, MaxCountExceededException {
+        return T_TEST.tTest(sample1, sample2, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double[], double[])
+     */
+    public static double tTest(final double[] sample1, final double[] sample2)
+        throws NullArgumentException, NumberIsTooSmallException,
+        MaxCountExceededException {
+        return T_TEST.tTest(sample1, sample2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary, double)
+     */
+    public static boolean tTest(final StatisticalSummary sampleStats1,
+                                final StatisticalSummary sampleStats2,
+                                final double alpha)
+        throws NullArgumentException, NumberIsTooSmallException,
+        OutOfRangeException, MaxCountExceededException {
+        return T_TEST.tTest(sampleStats1, sampleStats2, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
+     */
+    public static double tTest(final StatisticalSummary sampleStats1,
+                               final StatisticalSummary sampleStats2)
+        throws NullArgumentException, NumberIsTooSmallException,
+        MaxCountExceededException {
+        return T_TEST.tTest(sampleStats1, sampleStats2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquare(double[], long[])
+     */
+    public static double chiSquare(final double[] expected, final long[] observed)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException {
+        return CHI_SQUARE_TEST.chiSquare(expected, observed);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquare(long[][])
+     */
+    public static double chiSquare(final long[][] counts)
+        throws NullArgumentException, NotPositiveException,
+        DimensionMismatchException {
+        return CHI_SQUARE_TEST.chiSquare(counts);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(double[], long[], double)
+     */
+    public static boolean chiSquareTest(final double[] expected, final long[] observed,
+                                        final double alpha)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException, OutOfRangeException, MaxCountExceededException {
+        return CHI_SQUARE_TEST.chiSquareTest(expected, observed, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(double[], long[])
+     */
+    public static double chiSquareTest(final double[] expected, final long[] observed)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException, MaxCountExceededException {
+        return CHI_SQUARE_TEST.chiSquareTest(expected, observed);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(long[][], double)
+     */
+    public static boolean chiSquareTest(final long[][] counts, final double alpha)
+        throws NullArgumentException, DimensionMismatchException,
+        NotPositiveException, OutOfRangeException, MaxCountExceededException {
+        return CHI_SQUARE_TEST.chiSquareTest(counts, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(long[][])
+     */
+    public static double chiSquareTest(final long[][] counts)
+        throws NullArgumentException, DimensionMismatchException,
+        NotPositiveException, MaxCountExceededException {
+        return CHI_SQUARE_TEST.chiSquareTest(counts);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareDataSetsComparison(long[], long[])
+     *
+     * @since 1.2
+     */
+    public static double chiSquareDataSetsComparison(final long[] observed1,
+                                                     final long[] observed2)
+        throws DimensionMismatchException, NotPositiveException, ZeroException {
+        return CHI_SQUARE_TEST.chiSquareDataSetsComparison(observed1, observed2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[])
+     *
+     * @since 1.2
+     */
+    public static double chiSquareTestDataSetsComparison(final long[] observed1,
+                                                         final long[] observed2)
+        throws DimensionMismatchException, NotPositiveException, ZeroException,
+        MaxCountExceededException {
+        return CHI_SQUARE_TEST.chiSquareTestDataSetsComparison(observed1, observed2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[], double)
+     *
+     * @since 1.2
+     */
+    public static boolean chiSquareTestDataSetsComparison(final long[] observed1,
+                                                          final long[] observed2,
+                                                          final double alpha)
+        throws DimensionMismatchException, NotPositiveException,
+        ZeroException, OutOfRangeException, MaxCountExceededException {
+        return CHI_SQUARE_TEST.chiSquareTestDataSetsComparison(observed1, observed2, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaFValue(Collection)
+     *
+     * @since 1.2
+     */
+    public static double oneWayAnovaFValue(final Collection<double[]> categoryData)
+        throws NullArgumentException, DimensionMismatchException {
+        return ONE_WAY_ANANOVA.anovaFValue(categoryData);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaPValue(Collection)
+     *
+     * @since 1.2
+     */
+    public static double oneWayAnovaPValue(final Collection<double[]> categoryData)
+        throws NullArgumentException, DimensionMismatchException,
+        ConvergenceException, MaxCountExceededException {
+        return ONE_WAY_ANANOVA.anovaPValue(categoryData);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaTest(Collection,double)
+     *
+     * @since 1.2
+     */
+    public static boolean oneWayAnovaTest(final Collection<double[]> categoryData,
+                                          final double alpha)
+        throws NullArgumentException, DimensionMismatchException,
+        OutOfRangeException, ConvergenceException, MaxCountExceededException {
+        return ONE_WAY_ANANOVA.anovaTest(categoryData, alpha);
+    }
+
+     /**
+     * @see org.apache.commons.math4.stat.inference.GTest#g(double[], long[])
+     * @since 3.1
+     */
+    public static double g(final double[] expected, final long[] observed)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException {
+        return G_TEST.g(expected, observed);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.GTest#gTest( double[],  long[] )
+     * @since 3.1
+     */
+    public static double gTest(final double[] expected, final long[] observed)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException, MaxCountExceededException {
+        return G_TEST.gTest(expected, observed);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.GTest#gTestIntrinsic(double[], long[] )
+     * @since 3.1
+     */
+    public static double gTestIntrinsic(final double[] expected, final long[] observed)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException, MaxCountExceededException {
+        return G_TEST.gTestIntrinsic(expected, observed);
+    }
+
+     /**
+     * @see org.apache.commons.math4.stat.inference.GTest#gTest( double[],long[],double)
+     * @since 3.1
+     */
+    public static boolean gTest(final double[] expected, final long[] observed,
+                                final double alpha)
+        throws NotPositiveException, NotStrictlyPositiveException,
+        DimensionMismatchException, OutOfRangeException, MaxCountExceededException {
+        return G_TEST.gTest(expected, observed, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.GTest#gDataSetsComparison(long[], long[])
+     * @since 3.1
+     */
+    public static double gDataSetsComparison(final long[] observed1,
+                                                  final long[] observed2)
+        throws DimensionMismatchException, NotPositiveException, ZeroException {
+        return G_TEST.gDataSetsComparison(observed1, observed2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.GTest#rootLogLikelihoodRatio(long, long, long, long)
+     * @since 3.1
+     */
+    public static double rootLogLikelihoodRatio(final long k11, final long k12, final long k21, final long k22)
+        throws DimensionMismatchException, NotPositiveException, ZeroException {
+        return G_TEST.rootLogLikelihoodRatio(k11, k12, k21, k22);
+    }
+
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.GTest#gTestDataSetsComparison(long[], long[])
+     * @since 3.1
+     */
+    public static double gTestDataSetsComparison(final long[] observed1,
+                                                        final long[] observed2)
+        throws DimensionMismatchException, NotPositiveException, ZeroException,
+        MaxCountExceededException {
+        return G_TEST.gTestDataSetsComparison(observed1, observed2);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.GTest#gTestDataSetsComparison(long[],long[],double)
+     * @since 3.1
+     */
+    public static boolean gTestDataSetsComparison(final long[] observed1,
+                                                  final long[] observed2,
+                                                  final double alpha)
+        throws DimensionMismatchException, NotPositiveException,
+        ZeroException, OutOfRangeException, MaxCountExceededException {
+        return G_TEST.gTestDataSetsComparison(observed1, observed2, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(RealDistribution, double[])
+     * @since 3.3
+     */
+    public static double kolmogorovSmirnovStatistic(RealDistribution dist, double[] data)
+            throws InsufficientDataException, NullArgumentException {
+        return KS_TEST.kolmogorovSmirnovStatistic(dist, data);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[])
+     * @since 3.3
+     */
+    public static double kolmogorovSmirnovTest(RealDistribution dist, double[] data)
+            throws InsufficientDataException, NullArgumentException {
+        return KS_TEST.kolmogorovSmirnovTest(dist, data);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], boolean)
+     * @since 3.3
+     */
+    public static double kolmogorovSmirnovTest(RealDistribution dist, double[] data, boolean strict)
+            throws InsufficientDataException, NullArgumentException {
+        return KS_TEST.kolmogorovSmirnovTest(dist, data, strict);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], double)
+     * @since 3.3
+     */
+    public static boolean kolmogorovSmirnovTest(RealDistribution dist, double[] data, double alpha)
+            throws InsufficientDataException, NullArgumentException {
+        return KS_TEST.kolmogorovSmirnovTest(dist, data, alpha);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(double[], double[])
+     * @since 3.3
+     */
+    public static double kolmogorovSmirnovStatistic(double[] x, double[] y)
+            throws InsufficientDataException, NullArgumentException {
+        return KS_TEST.kolmogorovSmirnovStatistic(x, y);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[])
+     * @since 3.3
+     */
+    public static double kolmogorovSmirnovTest(double[] x, double[] y)
+            throws InsufficientDataException, NullArgumentException {
+        return KS_TEST.kolmogorovSmirnovTest(x, y);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[], boolean)
+     * @since 3.3
+     */
+    public static double kolmogorovSmirnovTest(double[] x, double[] y, boolean strict)
+            throws InsufficientDataException, NullArgumentException  {
+        return KS_TEST.kolmogorovSmirnovTest(x, y, strict);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#exactP(double, int, int, boolean)
+     * @since 3.3
+     */
+    public static double exactP(double d, int m, int n, boolean strict) {
+        return KS_TEST.exactP(d, n, m, strict);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#approximateP(double, int, int)
+     * @since 3.3
+     */
+    public static double approximateP(double d, int n, int m) {
+        return KS_TEST.approximateP(d, n, m);
+    }
+
+    /**
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#monteCarloP(double, int, int, boolean, int)
+     * @since 3.3
+     */
+    public static double monteCarloP(double d, int n, int m, boolean strict, int iterations) {
+        return KS_TEST.monteCarloP(d, n, m, strict, iterations);
+    }
+
+
+    // CHECKSTYLE: resume JavadocMethodCheck
+
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/5c341d9d/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java b/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
deleted file mode 100644
index a2bcb3f..0000000
--- a/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.stat.inference;
-
-import java.util.Collection;
-
-import org.apache.commons.math4.distribution.RealDistribution;
-import org.apache.commons.math4.exception.ConvergenceException;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.InsufficientDataException;
-import org.apache.commons.math4.exception.MaxCountExceededException;
-import org.apache.commons.math4.exception.NoDataException;
-import org.apache.commons.math4.exception.NotPositiveException;
-import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-import org.apache.commons.math4.exception.NullArgumentException;
-import org.apache.commons.math4.exception.NumberIsTooSmallException;
-import org.apache.commons.math4.exception.OutOfRangeException;
-import org.apache.commons.math4.exception.ZeroException;
-import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
-
-/**
- * A collection of static methods to create inference test instances or to
- * perform inference tests.
- *
- * @since 1.1
- */
-public class TestUtils  {
-
-    /** Singleton TTest instance. */
-    private static final TTest T_TEST = new TTest();
-
-    /** Singleton ChiSquareTest instance. */
-    private static final ChiSquareTest CHI_SQUARE_TEST = new ChiSquareTest();
-
-    /** Singleton OneWayAnova instance. */
-    private static final OneWayAnova ONE_WAY_ANANOVA = new OneWayAnova();
-
-    /** Singleton G-Test instance. */
-    private static final GTest G_TEST = new GTest();
-
-    /** Singleton K-S test instance */
-    private static final KolmogorovSmirnovTest KS_TEST = new KolmogorovSmirnovTest();
-
-    /**
-     * Prevent instantiation.
-     */
-    private TestUtils() {
-        super();
-    }
-
-    // CHECKSTYLE: stop JavadocMethodCheck
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticT(double[], double[])
-     */
-    public static double homoscedasticT(final double[] sample1, final double[] sample2)
-        throws NullArgumentException, NumberIsTooSmallException {
-        return T_TEST.homoscedasticT(sample1, sample2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticT(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
-     */
-    public static double homoscedasticT(final StatisticalSummary sampleStats1,
-                                        final StatisticalSummary sampleStats2)
-        throws NullArgumentException, NumberIsTooSmallException {
-        return T_TEST.homoscedasticT(sampleStats1, sampleStats2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(double[], double[], double)
-     */
-    public static boolean homoscedasticTTest(final double[] sample1, final double[] sample2,
-                                             final double alpha)
-        throws NullArgumentException, NumberIsTooSmallException,
-        OutOfRangeException, MaxCountExceededException {
-        return T_TEST.homoscedasticTTest(sample1, sample2, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(double[], double[])
-     */
-    public static double homoscedasticTTest(final double[] sample1, final double[] sample2)
-        throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException {
-        return T_TEST.homoscedasticTTest(sample1, sample2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
-     */
-    public static double homoscedasticTTest(final StatisticalSummary sampleStats1,
-                                            final StatisticalSummary sampleStats2)
-        throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException {
-        return T_TEST.homoscedasticTTest(sampleStats1, sampleStats2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#pairedT(double[], double[])
-     */
-    public static double pairedT(final double[] sample1, final double[] sample2)
-        throws NullArgumentException, NoDataException,
-        DimensionMismatchException, NumberIsTooSmallException {
-        return T_TEST.pairedT(sample1, sample2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#pairedTTest(double[], double[], double)
-     */
-    public static boolean pairedTTest(final double[] sample1, final double[] sample2,
-                                      final double alpha)
-        throws NullArgumentException, NoDataException, DimensionMismatchException,
-        NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException {
-        return T_TEST.pairedTTest(sample1, sample2, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#pairedTTest(double[], double[])
-     */
-    public static double pairedTTest(final double[] sample1, final double[] sample2)
-        throws NullArgumentException, NoDataException, DimensionMismatchException,
-        NumberIsTooSmallException, MaxCountExceededException {
-        return T_TEST.pairedTTest(sample1, sample2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#t(double, double[])
-     */
-    public static double t(final double mu, final double[] observed)
-        throws NullArgumentException, NumberIsTooSmallException {
-        return T_TEST.t(mu, observed);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#t(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
-     */
-    public static double t(final double mu, final StatisticalSummary sampleStats)
-        throws NullArgumentException, NumberIsTooSmallException {
-        return T_TEST.t(mu, sampleStats);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#t(double[], double[])
-     */
-    public static double t(final double[] sample1, final double[] sample2)
-        throws NullArgumentException, NumberIsTooSmallException {
-        return T_TEST.t(sample1, sample2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#t(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
-     */
-    public static double t(final StatisticalSummary sampleStats1,
-                           final StatisticalSummary sampleStats2)
-        throws NullArgumentException, NumberIsTooSmallException {
-        return T_TEST.t(sampleStats1, sampleStats2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, double[], double)
-     */
-    public static boolean tTest(final double mu, final double[] sample, final double alpha)
-        throws NullArgumentException, NumberIsTooSmallException,
-        OutOfRangeException, MaxCountExceededException {
-        return T_TEST.tTest(mu, sample, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, double[])
-     */
-    public static double tTest(final double mu, final double[] sample)
-        throws NullArgumentException, NumberIsTooSmallException,
-        MaxCountExceededException {
-        return T_TEST.tTest(mu, sample);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary, double)
-     */
-    public static boolean tTest(final double mu, final StatisticalSummary sampleStats,
-                                final double alpha)
-        throws NullArgumentException, NumberIsTooSmallException,
-        OutOfRangeException, MaxCountExceededException {
-        return T_TEST.tTest(mu, sampleStats, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
-     */
-    public static double tTest(final double mu, final StatisticalSummary sampleStats)
-        throws NullArgumentException, NumberIsTooSmallException,
-        MaxCountExceededException {
-        return T_TEST.tTest(mu, sampleStats);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double[], double[], double)
-     */
-    public static boolean tTest(final double[] sample1, final double[] sample2,
-                                final double alpha)
-        throws NullArgumentException, NumberIsTooSmallException,
-        OutOfRangeException, MaxCountExceededException {
-        return T_TEST.tTest(sample1, sample2, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double[], double[])
-     */
-    public static double tTest(final double[] sample1, final double[] sample2)
-        throws NullArgumentException, NumberIsTooSmallException,
-        MaxCountExceededException {
-        return T_TEST.tTest(sample1, sample2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary, double)
-     */
-    public static boolean tTest(final StatisticalSummary sampleStats1,
-                                final StatisticalSummary sampleStats2,
-                                final double alpha)
-        throws NullArgumentException, NumberIsTooSmallException,
-        OutOfRangeException, MaxCountExceededException {
-        return T_TEST.tTest(sampleStats1, sampleStats2, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.TTest#tTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
-     */
-    public static double tTest(final StatisticalSummary sampleStats1,
-                               final StatisticalSummary sampleStats2)
-        throws NullArgumentException, NumberIsTooSmallException,
-        MaxCountExceededException {
-        return T_TEST.tTest(sampleStats1, sampleStats2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquare(double[], long[])
-     */
-    public static double chiSquare(final double[] expected, final long[] observed)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException {
-        return CHI_SQUARE_TEST.chiSquare(expected, observed);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquare(long[][])
-     */
-    public static double chiSquare(final long[][] counts)
-        throws NullArgumentException, NotPositiveException,
-        DimensionMismatchException {
-        return CHI_SQUARE_TEST.chiSquare(counts);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(double[], long[], double)
-     */
-    public static boolean chiSquareTest(final double[] expected, final long[] observed,
-                                        final double alpha)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException, OutOfRangeException, MaxCountExceededException {
-        return CHI_SQUARE_TEST.chiSquareTest(expected, observed, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(double[], long[])
-     */
-    public static double chiSquareTest(final double[] expected, final long[] observed)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException, MaxCountExceededException {
-        return CHI_SQUARE_TEST.chiSquareTest(expected, observed);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(long[][], double)
-     */
-    public static boolean chiSquareTest(final long[][] counts, final double alpha)
-        throws NullArgumentException, DimensionMismatchException,
-        NotPositiveException, OutOfRangeException, MaxCountExceededException {
-        return CHI_SQUARE_TEST.chiSquareTest(counts, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(long[][])
-     */
-    public static double chiSquareTest(final long[][] counts)
-        throws NullArgumentException, DimensionMismatchException,
-        NotPositiveException, MaxCountExceededException {
-        return CHI_SQUARE_TEST.chiSquareTest(counts);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareDataSetsComparison(long[], long[])
-     *
-     * @since 1.2
-     */
-    public static double chiSquareDataSetsComparison(final long[] observed1,
-                                                     final long[] observed2)
-        throws DimensionMismatchException, NotPositiveException, ZeroException {
-        return CHI_SQUARE_TEST.chiSquareDataSetsComparison(observed1, observed2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[])
-     *
-     * @since 1.2
-     */
-    public static double chiSquareTestDataSetsComparison(final long[] observed1,
-                                                         final long[] observed2)
-        throws DimensionMismatchException, NotPositiveException, ZeroException,
-        MaxCountExceededException {
-        return CHI_SQUARE_TEST.chiSquareTestDataSetsComparison(observed1, observed2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[], double)
-     *
-     * @since 1.2
-     */
-    public static boolean chiSquareTestDataSetsComparison(final long[] observed1,
-                                                          final long[] observed2,
-                                                          final double alpha)
-        throws DimensionMismatchException, NotPositiveException,
-        ZeroException, OutOfRangeException, MaxCountExceededException {
-        return CHI_SQUARE_TEST.chiSquareTestDataSetsComparison(observed1, observed2, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaFValue(Collection)
-     *
-     * @since 1.2
-     */
-    public static double oneWayAnovaFValue(final Collection<double[]> categoryData)
-        throws NullArgumentException, DimensionMismatchException {
-        return ONE_WAY_ANANOVA.anovaFValue(categoryData);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaPValue(Collection)
-     *
-     * @since 1.2
-     */
-    public static double oneWayAnovaPValue(final Collection<double[]> categoryData)
-        throws NullArgumentException, DimensionMismatchException,
-        ConvergenceException, MaxCountExceededException {
-        return ONE_WAY_ANANOVA.anovaPValue(categoryData);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaTest(Collection,double)
-     *
-     * @since 1.2
-     */
-    public static boolean oneWayAnovaTest(final Collection<double[]> categoryData,
-                                          final double alpha)
-        throws NullArgumentException, DimensionMismatchException,
-        OutOfRangeException, ConvergenceException, MaxCountExceededException {
-        return ONE_WAY_ANANOVA.anovaTest(categoryData, alpha);
-    }
-
-     /**
-     * @see org.apache.commons.math4.stat.inference.GTest#g(double[], long[])
-     * @since 3.1
-     */
-    public static double g(final double[] expected, final long[] observed)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException {
-        return G_TEST.g(expected, observed);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.GTest#gTest( double[],  long[] )
-     * @since 3.1
-     */
-    public static double gTest(final double[] expected, final long[] observed)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException, MaxCountExceededException {
-        return G_TEST.gTest(expected, observed);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.GTest#gTestIntrinsic(double[], long[] )
-     * @since 3.1
-     */
-    public static double gTestIntrinsic(final double[] expected, final long[] observed)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException, MaxCountExceededException {
-        return G_TEST.gTestIntrinsic(expected, observed);
-    }
-
-     /**
-     * @see org.apache.commons.math4.stat.inference.GTest#gTest( double[],long[],double)
-     * @since 3.1
-     */
-    public static boolean gTest(final double[] expected, final long[] observed,
-                                final double alpha)
-        throws NotPositiveException, NotStrictlyPositiveException,
-        DimensionMismatchException, OutOfRangeException, MaxCountExceededException {
-        return G_TEST.gTest(expected, observed, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.GTest#gDataSetsComparison(long[], long[])
-     * @since 3.1
-     */
-    public static double gDataSetsComparison(final long[] observed1,
-                                                  final long[] observed2)
-        throws DimensionMismatchException, NotPositiveException, ZeroException {
-        return G_TEST.gDataSetsComparison(observed1, observed2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.GTest#rootLogLikelihoodRatio(long, long, long, long)
-     * @since 3.1
-     */
-    public static double rootLogLikelihoodRatio(final long k11, final long k12, final long k21, final long k22)
-        throws DimensionMismatchException, NotPositiveException, ZeroException {
-        return G_TEST.rootLogLikelihoodRatio(k11, k12, k21, k22);
-    }
-
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.GTest#gTestDataSetsComparison(long[], long[])
-     * @since 3.1
-     */
-    public static double gTestDataSetsComparison(final long[] observed1,
-                                                        final long[] observed2)
-        throws DimensionMismatchException, NotPositiveException, ZeroException,
-        MaxCountExceededException {
-        return G_TEST.gTestDataSetsComparison(observed1, observed2);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.GTest#gTestDataSetsComparison(long[],long[],double)
-     * @since 3.1
-     */
-    public static boolean gTestDataSetsComparison(final long[] observed1,
-                                                  final long[] observed2,
-                                                  final double alpha)
-        throws DimensionMismatchException, NotPositiveException,
-        ZeroException, OutOfRangeException, MaxCountExceededException {
-        return G_TEST.gTestDataSetsComparison(observed1, observed2, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(RealDistribution, double[])
-     * @since 3.3
-     */
-    public static double kolmogorovSmirnovStatistic(RealDistribution dist, double[] data)
-            throws InsufficientDataException, NullArgumentException {
-        return KS_TEST.kolmogorovSmirnovStatistic(dist, data);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[])
-     * @since 3.3
-     */
-    public static double kolmogorovSmirnovTest(RealDistribution dist, double[] data)
-            throws InsufficientDataException, NullArgumentException {
-        return KS_TEST.kolmogorovSmirnovTest(dist, data);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], boolean)
-     * @since 3.3
-     */
-    public static double kolmogorovSmirnovTest(RealDistribution dist, double[] data, boolean strict)
-            throws InsufficientDataException, NullArgumentException {
-        return KS_TEST.kolmogorovSmirnovTest(dist, data, strict);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], double)
-     * @since 3.3
-     */
-    public static boolean kolmogorovSmirnovTest(RealDistribution dist, double[] data, double alpha)
-            throws InsufficientDataException, NullArgumentException {
-        return KS_TEST.kolmogorovSmirnovTest(dist, data, alpha);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(double[], double[])
-     * @since 3.3
-     */
-    public static double kolmogorovSmirnovStatistic(double[] x, double[] y)
-            throws InsufficientDataException, NullArgumentException {
-        return KS_TEST.kolmogorovSmirnovStatistic(x, y);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[])
-     * @since 3.3
-     */
-    public static double kolmogorovSmirnovTest(double[] x, double[] y)
-            throws InsufficientDataException, NullArgumentException {
-        return KS_TEST.kolmogorovSmirnovTest(x, y);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[], boolean)
-     * @since 3.3
-     */
-    public static double kolmogorovSmirnovTest(double[] x, double[] y, boolean strict)
-            throws InsufficientDataException, NullArgumentException  {
-        return KS_TEST.kolmogorovSmirnovTest(x, y, strict);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#exactP(double, int, int, boolean)
-     * @since 3.3
-     */
-    public static double exactP(double d, int m, int n, boolean strict) {
-        return KS_TEST.exactP(d, n, m, strict);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#approximateP(double, int, int)
-     * @since 3.3
-     */
-    public static double approximateP(double d, int n, int m) {
-        return KS_TEST.approximateP(d, n, m);
-    }
-
-    /**
-     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#monteCarloP(double, int, int, boolean, int)
-     * @since 3.3
-     */
-    public static double monteCarloP(double d, int n, int m, boolean strict, int iterations) {
-        return KS_TEST.monteCarloP(d, n, m, strict, iterations);
-    }
-
-
-    // CHECKSTYLE: resume JavadocMethodCheck
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/5c341d9d/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
index 03054b8..b7859ba 100644
--- a/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
@@ -18,12 +18,11 @@ package org.apache.commons.math4.distribution;
 
 import java.util.Arrays;
 
-import org.apache.commons.math4.distribution.BetaDistribution;
 import org.apache.commons.math4.rng.RandomSource;
 import org.apache.commons.math4.rng.UniformRandomProvider;
 import org.apache.commons.math4.stat.StatUtils;
 import org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest;
-import org.apache.commons.math4.stat.inference.TestUtils;
+import org.apache.commons.math4.stat.inference.InferenceTestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -325,7 +324,7 @@ public class BetaDistributionTest {
             for (final double beta : alphaBetas) {
                 final BetaDistribution betaDistribution = new BetaDistribution(alpha, beta);
                 final double[] observed = AbstractRealDistribution.sample(numSamples,
-                                                                          betaDistribution.createSampler(rng));
+                        betaDistribution.createSampler(rng));
                 Arrays.sort(observed);
 
                 final String distribution = String.format("Beta(%.2f, %.2f)", alpha, beta);
@@ -380,6 +379,6 @@ public class BetaDistributionTest {
         final double[] expected = new double[numBins];
         Arrays.fill(expected, (double) values.length / numBins);
 
-        return TestUtils.gTest(expected, observed);
+        return InferenceTestUtils.gTest(expected, observed);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/5c341d9d/src/test/java/org/apache/commons/math4/stat/inference/InferenceTestUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/InferenceTestUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/inference/InferenceTestUtilsTest.java
new file mode 100644
index 0000000..e2d5ee1
--- /dev/null
+++ b/src/test/java/org/apache/commons/math4/stat/inference/InferenceTestUtilsTest.java
@@ -0,0 +1,557 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math4.stat.inference;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+/**
+ * Test cases for the TestUtils class.
+ *
+ */
+public class InferenceTestUtilsTest {
+
+    @Test
+    public void testChiSquare() {
+
+        // Target values computed using R version 1.8.1
+        // Some assembly required ;-)
+        //      Use sum((obs - exp)^2/exp) for the chi-square statistic and
+        //      1 - pchisq(sum((obs - exp)^2/exp), length(obs) - 1) for the p-value
+
+        long[] observed = {10, 9, 11};
+        double[] expected = {10, 10, 10};
+        Assert.assertEquals("chi-square statistic", 0.2,  InferenceTestUtils.chiSquare(expected, observed), 10E-12);
+        Assert.assertEquals("chi-square p-value", 0.904837418036, InferenceTestUtils.chiSquareTest(expected, observed), 1E-10);
+
+        long[] observed1 = { 500, 623, 72, 70, 31 };
+        double[] expected1 = { 485, 541, 82, 61, 37 };
+        Assert.assertEquals( "chi-square test statistic", 9.023307936427388, InferenceTestUtils.chiSquare(expected1, observed1), 1E-10);
+        Assert.assertEquals("chi-square p-value", 0.06051952647453607, InferenceTestUtils.chiSquareTest(expected1, observed1), 1E-9);
+        Assert.assertTrue("chi-square test reject", InferenceTestUtils.chiSquareTest(expected1, observed1, 0.07));
+        Assert.assertTrue("chi-square test accept", !InferenceTestUtils.chiSquareTest(expected1, observed1, 0.05));
+
+        try {
+            InferenceTestUtils.chiSquareTest(expected1, observed1, 95);
+            Assert.fail("alpha out of range, OutOfRangeException expected");
+        } catch (OutOfRangeException ex) {
+            // expected
+        }
+
+        long[] tooShortObs = { 0 };
+        double[] tooShortEx = { 1 };
+        try {
+            InferenceTestUtils.chiSquare(tooShortEx, tooShortObs);
+            Assert.fail("arguments too short, DimensionMismatchException expected");
+        } catch (DimensionMismatchException ex) {
+            // expected
+        }
+
+        // unmatched arrays
+        long[] unMatchedObs = { 0, 1, 2, 3 };
+        double[] unMatchedEx = { 1, 1, 2 };
+        try {
+            InferenceTestUtils.chiSquare(unMatchedEx, unMatchedObs);
+            Assert.fail("arrays have different lengths, DimensionMismatchException expected");
+        } catch (DimensionMismatchException ex) {
+            // expected
+        }
+
+        // 0 expected count
+        expected[0] = 0;
+        try {
+            InferenceTestUtils.chiSquareTest(expected, observed, .01);
+            Assert.fail("bad expected count, NotStrictlyPositiveException expected");
+        } catch (NotStrictlyPositiveException ex) {
+            // expected
+        }
+
+        // negative observed count
+        expected[0] = 1;
+        observed[0] = -1;
+        try {
+            InferenceTestUtils.chiSquareTest(expected, observed, .01);
+            Assert.fail("bad expected count, NotPositiveException expected");
+        } catch (NotPositiveException ex) {
+            // expected
+        }
+
+    }
+
+    @Test
+    public void testChiSquareIndependence() {
+
+        // Target values computed using R version 1.8.1
+
+        long[][] counts = { {40, 22, 43}, {91, 21, 28}, {60, 10, 22}};
+        Assert.assertEquals( "chi-square test statistic", 22.709027688, InferenceTestUtils.chiSquare(counts), 1E-9);
+        Assert.assertEquals("chi-square p-value", 0.000144751460134, InferenceTestUtils.chiSquareTest(counts), 1E-9);
+        Assert.assertTrue("chi-square test reject", InferenceTestUtils.chiSquareTest(counts, 0.0002));
+        Assert.assertTrue("chi-square test accept", !InferenceTestUtils.chiSquareTest(counts, 0.0001));
+
+        long[][] counts2 = {{10, 15}, {30, 40}, {60, 90} };
+        Assert.assertEquals( "chi-square test statistic", 0.168965517241, InferenceTestUtils.chiSquare(counts2), 1E-9);
+        Assert.assertEquals("chi-square p-value",0.918987499852, InferenceTestUtils.chiSquareTest(counts2), 1E-9);
+        Assert.assertTrue("chi-square test accept", !InferenceTestUtils.chiSquareTest(counts2, 0.1));
+
+        // ragged input array
+        long[][] counts3 = { {40, 22, 43}, {91, 21, 28}, {60, 10}};
+        try {
+            InferenceTestUtils.chiSquare(counts3);
+            Assert.fail("Expecting DimensionMismatchException");
+        } catch (DimensionMismatchException ex) {
+            // expected
+        }
+
+        // insufficient data
+        long[][] counts4 = {{40, 22, 43}};
+        try {
+            InferenceTestUtils.chiSquare(counts4);
+            Assert.fail("Expecting DimensionMismatchException");
+        } catch (DimensionMismatchException ex) {
+            // expected
+        }
+        long[][] counts5 = {{40}, {40}, {30}, {10}};
+        try {
+            InferenceTestUtils.chiSquare(counts5);
+            Assert.fail("Expecting DimensionMismatchException");
+        } catch (DimensionMismatchException ex) {
+            // expected
+        }
+
+        // negative counts
+        long[][] counts6 = {{10, -2}, {30, 40}, {60, 90} };
+        try {
+            InferenceTestUtils.chiSquare(counts6);
+            Assert.fail("Expecting NotPositiveException");
+        } catch (NotPositiveException ex) {
+            // expected
+        }
+
+        // bad alpha
+        try {
+            InferenceTestUtils.chiSquareTest(counts, 0);
+            Assert.fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testChiSquareLargeTestStatistic() {
+        double[] exp = new double[] {
+                3389119.5, 649136.6, 285745.4, 25357364.76, 11291189.78, 543628.0,
+                232921.0, 437665.75
+        };
+
+        long[] obs = new long[] {
+                2372383, 584222, 257170, 17750155, 7903832, 489265, 209628, 393899
+        };
+        org.apache.commons.math4.stat.inference.ChiSquareTest csti =
+            new org.apache.commons.math4.stat.inference.ChiSquareTest();
+        double cst = csti.chiSquareTest(exp, obs);
+        Assert.assertEquals("chi-square p-value", 0.0, cst, 1E-3);
+        Assert.assertEquals( "chi-square test statistic",
+                114875.90421929007, InferenceTestUtils.chiSquare(exp, obs), 1E-9);
+    }
+
+    /** Contingency table containing zeros - PR # 32531 */
+    @Test
+    public void testChiSquareZeroCount() {
+        // Target values computed using R version 1.8.1
+        long[][] counts = { {40, 0, 4}, {91, 1, 2}, {60, 2, 0}};
+        Assert.assertEquals( "chi-square test statistic", 9.67444662263,
+                InferenceTestUtils.chiSquare(counts), 1E-9);
+        Assert.assertEquals("chi-square p-value", 0.0462835770603,
+                InferenceTestUtils.chiSquareTest(counts), 1E-9);
+    }
+
+    private double[] tooShortObs = { 1.0 };
+    private double[] emptyObs = {};
+    private SummaryStatistics emptyStats = new SummaryStatistics();
+
+    @Test
+    public void testOneSampleT() {
+        double[] observed =
+            {93.0, 103.0, 95.0, 101.0, 91.0, 105.0, 96.0, 94.0, 101.0,  88.0, 98.0, 94.0, 101.0, 92.0, 95.0 };
+        double mu = 100.0;
+        SummaryStatistics sampleStats = null;
+        sampleStats = new SummaryStatistics();
+        for (int i = 0; i < observed.length; i++) {
+            sampleStats.addValue(observed[i]);
+        }
+
+        // Target comparison values computed using R version 1.8.1 (Linux version)
+        Assert.assertEquals("t statistic",  -2.81976445346,
+                InferenceTestUtils.t(mu, observed), 10E-10);
+        Assert.assertEquals("t statistic",  -2.81976445346,
+                InferenceTestUtils.t(mu, sampleStats), 10E-10);
+        Assert.assertEquals("p value", 0.0136390585873,
+                InferenceTestUtils.tTest(mu, observed), 10E-10);
+        Assert.assertEquals("p value", 0.0136390585873,
+                InferenceTestUtils.tTest(mu, sampleStats), 10E-10);
+
+        try {
+            InferenceTestUtils.t(mu, (double[]) null);
+            Assert.fail("arguments too short, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(mu, (SummaryStatistics) null);
+            Assert.fail("arguments too short, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(mu, emptyObs);
+            Assert.fail("arguments too short, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(mu, emptyStats);
+            Assert.fail("arguments too short, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(mu, tooShortObs);
+            Assert.fail("insufficient data to compute t statistic, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+        try {
+            InferenceTestUtils.tTest(mu, tooShortObs);
+            Assert.fail("insufficient data to perform t test, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(mu, (SummaryStatistics) null);
+            Assert.fail("insufficient data to compute t statistic, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+        try {
+            InferenceTestUtils.tTest(mu, (SummaryStatistics) null);
+            Assert.fail("insufficient data to perform t test, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testOneSampleTTest() {
+        double[] oneSidedP =
+            {2d, 0d, 6d, 6d, 3d, 3d, 2d, 3d, -6d, 6d, 6d, 6d, 3d, 0d, 1d, 1d, 0d, 2d, 3d, 3d };
+        SummaryStatistics oneSidedPStats = new SummaryStatistics();
+        for (int i = 0; i < oneSidedP.length; i++) {
+            oneSidedPStats.addValue(oneSidedP[i]);
+        }
+        // Target comparison values computed using R version 1.8.1 (Linux version)
+        Assert.assertEquals("one sample t stat", 3.86485535541,
+                InferenceTestUtils.t(0d, oneSidedP), 10E-10);
+        Assert.assertEquals("one sample t stat", 3.86485535541,
+                InferenceTestUtils.t(0d, oneSidedPStats),1E-10);
+        Assert.assertEquals("one sample p value", 0.000521637019637,
+                InferenceTestUtils.tTest(0d, oneSidedP) / 2d, 10E-10);
+        Assert.assertEquals("one sample p value", 0.000521637019637,
+                InferenceTestUtils.tTest(0d, oneSidedPStats) / 2d, 10E-5);
+        Assert.assertTrue("one sample t-test reject", InferenceTestUtils.tTest(0d, oneSidedP, 0.01));
+        Assert.assertTrue("one sample t-test reject", InferenceTestUtils.tTest(0d, oneSidedPStats, 0.01));
+        Assert.assertTrue("one sample t-test accept", !InferenceTestUtils.tTest(0d, oneSidedP, 0.0001));
+        Assert.assertTrue("one sample t-test accept", !InferenceTestUtils.tTest(0d, oneSidedPStats, 0.0001));
+
+        try {
+            InferenceTestUtils.tTest(0d, oneSidedP, 95);
+            Assert.fail("alpha out of range, OutOfRangeException expected");
+        } catch (OutOfRangeException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.tTest(0d, oneSidedPStats, 95);
+            Assert.fail("alpha out of range, OutOfRangeException expected");
+        } catch (OutOfRangeException ex) {
+            // expected
+        }
+
+    }
+
+    @Test
+    public void testTwoSampleTHeterscedastic() {
+        double[] sample1 = { 7d, -4d, 18d, 17d, -3d, -5d, 1d, 10d, 11d, -2d };
+        double[] sample2 = { -1d, 12d, -1d, -3d, 3d, -5d, 5d, 2d, -11d, -1d, -3d };
+        SummaryStatistics sampleStats1 = new SummaryStatistics();
+        for (int i = 0; i < sample1.length; i++) {
+            sampleStats1.addValue(sample1[i]);
+        }
+        SummaryStatistics sampleStats2 = new SummaryStatistics();
+        for (int i = 0; i < sample2.length; i++) {
+            sampleStats2.addValue(sample2[i]);
+        }
+
+        // Target comparison values computed using R version 1.8.1 (Linux version)
+        Assert.assertEquals("two sample heteroscedastic t stat", 1.60371728768,
+                InferenceTestUtils.t(sample1, sample2), 1E-10);
+        Assert.assertEquals("two sample heteroscedastic t stat", 1.60371728768,
+                InferenceTestUtils.t(sampleStats1, sampleStats2), 1E-10);
+        Assert.assertEquals("two sample heteroscedastic p value", 0.128839369622,
+                InferenceTestUtils.tTest(sample1, sample2), 1E-10);
+        Assert.assertEquals("two sample heteroscedastic p value", 0.128839369622,
+                InferenceTestUtils.tTest(sampleStats1, sampleStats2), 1E-10);
+        Assert.assertTrue("two sample heteroscedastic t-test reject",
+                InferenceTestUtils.tTest(sample1, sample2, 0.2));
+        Assert.assertTrue("two sample heteroscedastic t-test reject",
+                InferenceTestUtils.tTest(sampleStats1, sampleStats2, 0.2));
+        Assert.assertTrue("two sample heteroscedastic t-test accept",
+                !InferenceTestUtils.tTest(sample1, sample2, 0.1));
+        Assert.assertTrue("two sample heteroscedastic t-test accept",
+                !InferenceTestUtils.tTest(sampleStats1, sampleStats2, 0.1));
+
+        try {
+            InferenceTestUtils.tTest(sample1, sample2, .95);
+            Assert.fail("alpha out of range, OutOfRangeException expected");
+        } catch (OutOfRangeException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.tTest(sampleStats1, sampleStats2, .95);
+            Assert.fail("alpha out of range, OutOfRangeException expected");
+        } catch (OutOfRangeException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.tTest(sample1, tooShortObs, .01);
+            Assert.fail("insufficient data, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.tTest(sampleStats1, (SummaryStatistics) null, .01);
+            Assert.fail("insufficient data, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.tTest(sample1, tooShortObs);
+            Assert.fail("insufficient data, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.tTest(sampleStats1, (SummaryStatistics) null);
+            Assert.fail("insufficient data, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(sample1, tooShortObs);
+            Assert.fail("insufficient data, NumberIsTooSmallException expected");
+        } catch (NumberIsTooSmallException ex) {
+            // expected
+        }
+
+        try {
+            InferenceTestUtils.t(sampleStats1, (SummaryStatistics) null);
+            Assert.fail("insufficient data, NullArgumentException expected");
+        } catch (NullArgumentException ex) {
+            // expected
+        }
+    }
+    @Test
+    public void testTwoSampleTHomoscedastic() {
+        double[] sample1 ={2, 4, 6, 8, 10, 97};
+        double[] sample2 = {4, 6, 8, 10, 16};
+        SummaryStatistics sampleStats1 = new SummaryStatistics();
+        for (int i = 0; i < sample1.length; i++) {
+            sampleStats1.addValue(sample1[i]);
+        }
+        SummaryStatistics sampleStats2 = new SummaryStatistics();
+        for (int i = 0; i < sample2.length; i++) {
+            sampleStats2.addValue(sample2[i]);
+        }
+
+        // Target comparison values computed using R version 1.8.1 (Linux version)
+        Assert.assertEquals("two sample homoscedastic t stat", 0.73096310086,
+                InferenceTestUtils.homoscedasticT(sample1, sample2), 10E-11);
+        Assert.assertEquals("two sample homoscedastic p value", 0.4833963785,
+                InferenceTestUtils.homoscedasticTTest(sampleStats1, sampleStats2), 1E-10);
+        Assert.assertTrue("two sample homoscedastic t-test reject",
+                InferenceTestUtils.homoscedasticTTest(sample1, sample2, 0.49));
+        Assert.assertTrue("two sample homoscedastic t-test accept",
+                !InferenceTestUtils.homoscedasticTTest(sample1, sample2, 0.48));
+    }
+
+    @Test
+    public void testSmallSamples() {
+        double[] sample1 = {1d, 3d};
+        double[] sample2 = {4d, 5d};
+
+        // Target values computed using R, version 1.8.1 (linux version)
+        Assert.assertEquals(-2.2360679775, InferenceTestUtils.t(sample1, sample2),
+                1E-10);
+        Assert.assertEquals(0.198727388935, InferenceTestUtils.tTest(sample1, sample2),
+                1E-10);
+    }
+
+    @Test
+    public void testPaired() {
+        double[] sample1 = {1d, 3d, 5d, 7d};
+        double[] sample2 = {0d, 6d, 11d, 2d};
+        double[] sample3 = {5d, 7d, 8d, 10d};
+
+        // Target values computed using R, version 1.8.1 (linux version)
+        Assert.assertEquals(-0.3133, InferenceTestUtils.pairedT(sample1, sample2), 1E-4);
+        Assert.assertEquals(0.774544295819, InferenceTestUtils.pairedTTest(sample1, sample2), 1E-10);
+        Assert.assertEquals(0.001208, InferenceTestUtils.pairedTTest(sample1, sample3), 1E-6);
+        Assert.assertFalse(InferenceTestUtils.pairedTTest(sample1, sample3, .001));
+        Assert.assertTrue(InferenceTestUtils.pairedTTest(sample1, sample3, .002));
+    }
+
+    private double[] classA =
+      {93.0, 103.0, 95.0, 101.0};
+    private double[] classB =
+      {99.0, 92.0, 102.0, 100.0, 102.0};
+    private double[] classC =
+      {110.0, 115.0, 111.0, 117.0, 128.0};
+
+    private List<double[]> classes = new ArrayList<double[]>();
+    private OneWayAnova oneWayAnova = new OneWayAnova();
+
+    @Test
+    public void testOneWayAnovaUtils() {
+        classes.add(classA);
+        classes.add(classB);
+        classes.add(classC);
+        Assert.assertEquals(oneWayAnova.anovaFValue(classes),
+                InferenceTestUtils.oneWayAnovaFValue(classes), 10E-12);
+        Assert.assertEquals(oneWayAnova.anovaPValue(classes),
+                InferenceTestUtils.oneWayAnovaPValue(classes), 10E-12);
+        Assert.assertEquals(oneWayAnova.anovaTest(classes, 0.01),
+                InferenceTestUtils.oneWayAnovaTest(classes, 0.01));
+    }
+    @Test
+    public void testGTestGoodnesOfFit() throws Exception {
+        double[] exp = new double[]{
+            0.54d, 0.40d, 0.05d, 0.01d
+        };
+
+        long[] obs = new long[]{
+            70, 79, 3, 4
+        };
+        Assert.assertEquals("G test statistic",
+                13.144799, InferenceTestUtils.g(exp, obs), 1E-5);
+        double p_gtgf = InferenceTestUtils.gTest(exp, obs);
+        Assert.assertEquals("g-Test p-value", 0.004333, p_gtgf, 1E-5);
+
+        Assert.assertTrue(InferenceTestUtils.gTest(exp, obs, 0.05));
+}
+
+    @Test
+    public void testGTestIndependance() throws Exception {
+        long[] obs1 = new long[]{
+            268, 199, 42
+        };
+
+        long[] obs2 = new long[]{
+            807, 759, 184
+        };
+
+        double g = InferenceTestUtils.gDataSetsComparison(obs1, obs2);
+
+        Assert.assertEquals("G test statistic",
+                7.3008170, g, 1E-4);
+        double p_gti = InferenceTestUtils.gTestDataSetsComparison(obs1, obs2);
+
+        Assert.assertEquals("g-Test p-value", 0.0259805, p_gti, 1E-4);
+        Assert.assertTrue(InferenceTestUtils.gTestDataSetsComparison(obs1, obs2, 0.05));
+    }
+
+    @Test
+    public void testRootLogLikelihood() {
+        // positive where k11 is bigger than expected.
+        Assert.assertTrue(InferenceTestUtils.rootLogLikelihoodRatio(904, 21060, 1144, 283012) > 0.0);
+
+        // negative because k11 is lower than expected
+        Assert.assertTrue(InferenceTestUtils.rootLogLikelihoodRatio(36, 21928, 60280, 623876) < 0.0);
+
+        Assert.assertEquals(FastMath.sqrt(2.772589), InferenceTestUtils.rootLogLikelihoodRatio(1, 0, 0, 1), 0.000001);
+        Assert.assertEquals(-FastMath.sqrt(2.772589), InferenceTestUtils.rootLogLikelihoodRatio(0, 1, 1, 0), 0.000001);
+        Assert.assertEquals(FastMath.sqrt(27.72589), InferenceTestUtils.rootLogLikelihoodRatio(10, 0, 0, 10), 0.00001);
+
+        Assert.assertEquals(FastMath.sqrt(39.33052), InferenceTestUtils.rootLogLikelihoodRatio(5, 1995, 0, 100000), 0.00001);
+        Assert.assertEquals(-FastMath.sqrt(39.33052), InferenceTestUtils.rootLogLikelihoodRatio(0, 100000, 5, 1995), 0.00001);
+
+        Assert.assertEquals(FastMath.sqrt(4730.737), InferenceTestUtils.rootLogLikelihoodRatio(1000, 1995, 1000, 100000), 0.001);
+        Assert.assertEquals(-FastMath.sqrt(4730.737), InferenceTestUtils.rootLogLikelihoodRatio(1000, 100000, 1000, 1995), 0.001);
+
+        Assert.assertEquals(FastMath.sqrt(5734.343), InferenceTestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 100000), 0.001);
+        Assert.assertEquals(FastMath.sqrt(5714.932), InferenceTestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 99000), 0.001);
+    }
+
+    @Test
+    public void testKSOneSample() throws Exception {
+       final NormalDistribution unitNormal = new NormalDistribution(0d, 1d);
+       final double[] sample = KolmogorovSmirnovTestTest.gaussian;
+       final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
+       Assert.assertEquals(0.3172069207622391, InferenceTestUtils.kolmogorovSmirnovTest(unitNormal, sample), tol);
+       Assert.assertEquals(0.0932947561266756, InferenceTestUtils.kolmogorovSmirnovStatistic(unitNormal, sample), tol);
+    }
+
+    @Test
+    public void testKSTwoSample() throws Exception {
+        final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
+        final double[] smallSample1 = {
+            6, 7, 9, 13, 19, 21, 22, 23, 24
+        };
+        final double[] smallSample2 = {
+            10, 11, 12, 16, 20, 27, 28, 32, 44, 54
+        };
+        Assert
+            .assertEquals(0.105577085453247, InferenceTestUtils.kolmogorovSmirnovTest(smallSample1, smallSample2, false), tol);
+        final double d = InferenceTestUtils.kolmogorovSmirnovStatistic(smallSample1, smallSample2);
+        Assert.assertEquals(0.5, d, tol);
+        Assert
+        .assertEquals(0.105577085453247, InferenceTestUtils.exactP(d, smallSample1.length, smallSample2.length, false), tol);
+    }
+}


[6/7] [math] Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8

Posted by eb...@apache.org.
Fix "FastMath#round(..)" to comply to changed contract of "Math#round()" in Java 8


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/83b70a37
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/83b70a37
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/83b70a37

Branch: refs/heads/develop
Commit: 83b70a377f79ba90f846b3a720e6c402c63bccc5
Parents: 540564e
Author: Thomas Neidhart <th...@gmail.com>
Authored: Fri Aug 5 15:17:43 2016 +0200
Committer: Emmanuel Bourg <eb...@apache.org>
Committed: Fri Aug 5 15:17:43 2016 +0200

----------------------------------------------------------------------
 .../org/apache/commons/math4/util/FastMath.java |   40 +-
 .../apache/commons/math4/util/FastMathTest.java | 1019 ++++++++----------
 2 files changed, 505 insertions(+), 554 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/83b70a37/src/main/java/org/apache/commons/math4/util/FastMath.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/FastMath.java b/src/main/java/org/apache/commons/math4/util/FastMath.java
index 2532c62..dbcd266 100644
--- a/src/main/java/org/apache/commons/math4/util/FastMath.java
+++ b/src/main/java/org/apache/commons/math4/util/FastMath.java
@@ -3510,7 +3510,25 @@ public class FastMath {
      * @return closest long to x
      */
     public static long round(double x) {
-        return (long) floor(x + 0.5);
+        final long bits = Double.doubleToRawLongBits(x);
+        final int biasedExp = ((int)(bits>>52)) & 0x7ff;
+        // Shift to get rid of bits past comma except first one: will need to
+        // 1-shift to the right to end up with correct magnitude.
+        final int shift = (52 - 1 + Double.MAX_EXPONENT) - biasedExp;
+        if ((shift & -64) == 0) {
+            // shift in [0,63], so unbiased exp in [-12,51].
+            long extendedMantissa = 0x0010000000000000L | (bits & 0x000fffffffffffffL);
+            if (bits < 0) {
+                extendedMantissa = -extendedMantissa;
+            }
+            // If value is positive and first bit past comma is 0, rounding
+            // to lower integer, else to upper one, which is what "+1" and
+            // then ">>1" do.
+            return ((extendedMantissa >> shift) + 1L) >> 1;
+        } else {
+            // +-Infinity, NaN, or a mathematical integer.
+            return (long) x;
+        }
     }
 
     /** Get the closest int to x.
@@ -3518,7 +3536,25 @@ public class FastMath {
      * @return closest int to x
      */
     public static int round(final float x) {
-        return (int) floor(x + 0.5f);
+        final int bits = Float.floatToRawIntBits(x);
+        final int biasedExp = (bits>>23) & 0xff;
+        // Shift to get rid of bits past comma except first one: will need to
+        // 1-shift to the right to end up with correct magnitude.
+        final int shift = (23 - 1 + Float.MAX_EXPONENT) - biasedExp;
+        if ((shift & -32) == 0) {
+            // shift in [0,31], so unbiased exp in [-9,22].
+            int extendedMantissa = 0x00800000 | (bits & 0x007fffff);
+            if (bits < 0) {
+                extendedMantissa = -extendedMantissa;
+            }
+            // If value is positive and first bit past comma is 0, rounding
+            // to lower integer, else to upper one, which is what "+1" and
+            // then ">>1" do.
+            return ((extendedMantissa >> shift) + 1) >> 1;
+        } else {
+            // +-Infinity, NaN, or a mathematical integer.
+            return (int) x;
+        }
     }
 
     /** Compute the minimum of two values


[7/7] [math] Fix KthSelector to consider natural order of doubles

Posted by eb...@apache.org.
Fix KthSelector to consider natural order of doubles


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/81931848
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/81931848
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/81931848

Branch: refs/heads/develop
Commit: 819318486d9cfb430749ee33d3c5c4ec4417babc
Parents: 83b70a3
Author: Otmar Ertl <ot...@gmail.com>
Authored: Fri Aug 5 17:03:09 2016 +0200
Committer: Emmanuel Bourg <eb...@apache.org>
Committed: Fri Aug 5 17:03:09 2016 +0200

----------------------------------------------------------------------
 .../apache/commons/math4/util/KthSelector.java  |  6 +--
 .../commons/math4/util/KthSelectorTest.java     | 56 ++++++++++++++++++++
 2 files changed, 59 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/81931848/src/main/java/org/apache/commons/math4/util/KthSelector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/KthSelector.java b/src/main/java/org/apache/commons/math4/util/KthSelector.java
index 9a71a2f..2820cbf 100644
--- a/src/main/java/org/apache/commons/math4/util/KthSelector.java
+++ b/src/main/java/org/apache/commons/math4/util/KthSelector.java
@@ -133,10 +133,10 @@ public class KthSelector implements Serializable {
         int i = begin + 1;
         int j = end - 1;
         while (i < j) {
-            while (i < j && work[j] > value) {
+            while (i < j && Double.compare(work[j], value) > 0) {
                 --j;
             }
-            while (i < j && work[i] < value) {
+            while (i < j && Double.compare(work[i], value) < 0) {
                 ++i;
             }
 
@@ -147,7 +147,7 @@ public class KthSelector implements Serializable {
             }
         }
 
-        if (i >= end || work[i] > value) {
+        if (i >= end || Double.compare(work[i], value) > 0) {
             --i;
         }
         work[begin] = work[i];

http://git-wip-us.apache.org/repos/asf/commons-math/blob/81931848/src/test/java/org/apache/commons/math4/util/KthSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/KthSelectorTest.java b/src/test/java/org/apache/commons/math4/util/KthSelectorTest.java
new file mode 100644
index 0000000..a366257
--- /dev/null
+++ b/src/test/java/org/apache/commons/math4/util/KthSelectorTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math4.util;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.Random;
+
+import org.junit.Test;
+
+public class KthSelectorTest {
+
+    @Test
+    public void testRandom() {
+        
+        final int numIterations = 100000;
+        final double[] possibleValues = {Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.MAX_VALUE, Double.MIN_VALUE, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, -0., 0., 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+        final Random rnd = new Random(0);
+        for (int i = 0; i < numIterations; ++i) {
+            
+            final int dataSize = rnd.nextInt(30);
+
+            final double[] data = new double[dataSize];
+
+            for (int j = 0; j < dataSize; ++j) {
+                data[j] = possibleValues[rnd.nextInt(possibleValues.length)];
+            }
+            
+            final double[] dataSorted = Arrays.copyOf(data, data.length);
+            Arrays.sort(dataSorted);
+
+            for (int j = 0; j < dataSize; ++j) {
+
+                final double[] dataTmp = Arrays.copyOf(data, data.length);
+                final double resultKthSelector = new KthSelector().select(dataTmp, null, j);
+                final double resultSort = dataSorted[j];
+                assertEquals(Double.doubleToLongBits(resultKthSelector), Double.doubleToLongBits(resultSort));
+            }
+        }
+    }
+}