commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r951633 [44/49] - in /websites/production/commons/content/proper/commons-math: xref-test/ xref-test/org/apache/commons/math3/ xref-test/org/apache/commons/math3/analysis/ xref-test/org/apache/commons/math3/analysis/differentiation/ xref-tes...
Date Sun, 17 May 2015 17:05:54 GMT
Modified: websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html (original)
+++ websites/production/commons/content/proper/commons-math/xref/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html Sun May 17 17:05:50 2015
@@ -306,277 +306,277 @@
 <a class="jxr_linenumber" name="L298" href="#L298">298</a>         <strong class="jxr_keyword">double</strong> supD = 0d;
 <a class="jxr_linenumber" name="L299" href="#L299">299</a>         <em class="jxr_comment">// First walk x points</em>
 <a class="jxr_linenumber" name="L300" href="#L300">300</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; n; i++) {
-<a class="jxr_linenumber" name="L301" href="#L301">301</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_x = (i + 1d) / n;
-<a class="jxr_linenumber" name="L302" href="#L302">302</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> yIndex = Arrays.binarySearch(sy, sx[i]);
-<a class="jxr_linenumber" name="L303" href="#L303">303</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_y = yIndex &gt;= 0 ? (yIndex + 1d) / m : (-yIndex - 1d) / m;
-<a class="jxr_linenumber" name="L304" href="#L304">304</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> curD = FastMath.abs(cdf_x - cdf_y);
-<a class="jxr_linenumber" name="L305" href="#L305">305</a>             <strong class="jxr_keyword">if</strong> (curD &gt; supD) {
-<a class="jxr_linenumber" name="L306" href="#L306">306</a>                 supD = curD;
-<a class="jxr_linenumber" name="L307" href="#L307">307</a>             }
-<a class="jxr_linenumber" name="L308" href="#L308">308</a>         }
-<a class="jxr_linenumber" name="L309" href="#L309">309</a>         <em class="jxr_comment">// Now look at y</em>
-<a class="jxr_linenumber" name="L310" href="#L310">310</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; m; i++) {
-<a class="jxr_linenumber" name="L311" href="#L311">311</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_y = (i + 1d) / m;
-<a class="jxr_linenumber" name="L312" href="#L312">312</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> xIndex = Arrays.binarySearch(sx, sy[i]);
-<a class="jxr_linenumber" name="L313" href="#L313">313</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_x = xIndex &gt;= 0 ? (xIndex + 1d) / n : (-xIndex - 1d) / n;
-<a class="jxr_linenumber" name="L314" href="#L314">314</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> curD = FastMath.abs(cdf_x - cdf_y);
-<a class="jxr_linenumber" name="L315" href="#L315">315</a>             <strong class="jxr_keyword">if</strong> (curD &gt; supD) {
-<a class="jxr_linenumber" name="L316" href="#L316">316</a>                 supD = curD;
-<a class="jxr_linenumber" name="L317" href="#L317">317</a>             }
-<a class="jxr_linenumber" name="L318" href="#L318">318</a>         }
-<a class="jxr_linenumber" name="L319" href="#L319">319</a>         <strong class="jxr_keyword">return</strong> supD;
-<a class="jxr_linenumber" name="L320" href="#L320">320</a>     }
-<a class="jxr_linenumber" name="L321" href="#L321">321</a> 
-<a class="jxr_linenumber" name="L322" href="#L322">322</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L323" href="#L323">323</a> <em class="jxr_javadoccomment">     * Computes the &lt;i&gt;p-value&lt;/i&gt;, or &lt;i&gt;observed significance level&lt;/i&gt;, of a one-sample &lt;a</em>
-<a class="jxr_linenumber" name="L324" href="#L324">324</a> <em class="jxr_javadoccomment">     * href="<a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test" target="alexandria_uri">http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test</a>"&gt; Kolmogorov-Smirnov test&lt;/a&gt;</em>
-<a class="jxr_linenumber" name="L325" href="#L325">325</a> <em class="jxr_javadoccomment">     * evaluating the null hypothesis that {@code data} conforms to {@code distribution}.</em>
-<a class="jxr_linenumber" name="L326" href="#L326">326</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L327" href="#L327">327</a> <em class="jxr_javadoccomment">     * @param distribution reference distribution</em>
-<a class="jxr_linenumber" name="L328" href="#L328">328</a> <em class="jxr_javadoccomment">     * @param data sample being being evaluated</em>
-<a class="jxr_linenumber" name="L329" href="#L329">329</a> <em class="jxr_javadoccomment">     * @return the p-value associated with the null hypothesis that {@code data} is a sample from</em>
-<a class="jxr_linenumber" name="L330" href="#L330">330</a> <em class="jxr_javadoccomment">     *         {@code distribution}</em>
-<a class="jxr_linenumber" name="L331" href="#L331">331</a> <em class="jxr_javadoccomment">     * @throws InsufficientDataException if {@code data} does not have length at least 2</em>
-<a class="jxr_linenumber" name="L332" href="#L332">332</a> <em class="jxr_javadoccomment">     * @throws NullArgumentException if {@code data} is null</em>
-<a class="jxr_linenumber" name="L333" href="#L333">333</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L334" href="#L334">334</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html">RealDistribution</a> distribution, <strong class="jxr_keyword">double</strong>[] data) {
-<a class="jxr_linenumber" name="L335" href="#L335">335</a>         <strong class="jxr_keyword">return</strong> kolmogorovSmirnovTest(distribution, data, false);
-<a class="jxr_linenumber" name="L336" href="#L336">336</a>     }
-<a class="jxr_linenumber" name="L337" href="#L337">337</a> 
-<a class="jxr_linenumber" name="L338" href="#L338">338</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L339" href="#L339">339</a> <em class="jxr_javadoccomment">     * Performs a &lt;a href="<a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test" target="alexandria_uri">http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test</a>"&gt; Kolmogorov-Smirnov</em>
-<a class="jxr_linenumber" name="L340" href="#L340">340</a> <em class="jxr_javadoccomment">     * test&lt;/a&gt; evaluating the null hypothesis that {@code data} conforms to {@code distribution}.</em>
-<a class="jxr_linenumber" name="L341" href="#L341">341</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L342" href="#L342">342</a> <em class="jxr_javadoccomment">     * @param distribution reference distribution</em>
-<a class="jxr_linenumber" name="L343" href="#L343">343</a> <em class="jxr_javadoccomment">     * @param data sample being being evaluated</em>
-<a class="jxr_linenumber" name="L344" href="#L344">344</a> <em class="jxr_javadoccomment">     * @param alpha significance level of the test</em>
-<a class="jxr_linenumber" name="L345" href="#L345">345</a> <em class="jxr_javadoccomment">     * @return true iff the null hypothesis that {@code data} is a sample from {@code distribution}</em>
-<a class="jxr_linenumber" name="L346" href="#L346">346</a> <em class="jxr_javadoccomment">     *         can be rejected with confidence 1 - {@code alpha}</em>
-<a class="jxr_linenumber" name="L347" href="#L347">347</a> <em class="jxr_javadoccomment">     * @throws InsufficientDataException if {@code data} does not have length at least 2</em>
-<a class="jxr_linenumber" name="L348" href="#L348">348</a> <em class="jxr_javadoccomment">     * @throws NullArgumentException if {@code data} is null</em>
-<a class="jxr_linenumber" name="L349" href="#L349">349</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L350" href="#L350">350</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html">RealDistribution</a> distribution, <strong class="jxr_keyword">double</strong>[] data, <strong class="jxr_keyword">double</strong> alpha) {
-<a class="jxr_linenumber" name="L351" href="#L351">351</a>         <strong class="jxr_keyword">if</strong> ((alpha &lt;= 0) || (alpha &gt; 0.5)) {
-<a class="jxr_linenumber" name="L352" href="#L352">352</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL, alpha, 0, 0.5);
-<a class="jxr_linenumber" name="L353" href="#L353">353</a>         }
-<a class="jxr_linenumber" name="L354" href="#L354">354</a>         <strong class="jxr_keyword">return</strong> kolmogorovSmirnovTest(distribution, data) &lt; alpha;
-<a class="jxr_linenumber" name="L355" href="#L355">355</a>     }
-<a class="jxr_linenumber" name="L356" href="#L356">356</a> 
-<a class="jxr_linenumber" name="L357" href="#L357">357</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L358" href="#L358">358</a> <em class="jxr_javadoccomment">     * Calculates \(P(D_n &lt; d)\) using the method described in [1] with quick decisions for extreme</em>
-<a class="jxr_linenumber" name="L359" href="#L359">359</a> <em class="jxr_javadoccomment">     * values given in [2] (see above). The result is not exact as with</em>
-<a class="jxr_linenumber" name="L360" href="#L360">360</a> <em class="jxr_javadoccomment">     * {@link #cdfExact(double, int)} because calculations are based on</em>
-<a class="jxr_linenumber" name="L361" href="#L361">361</a> <em class="jxr_javadoccomment">     * {@code double} rather than {@link org.apache.commons.math3.fraction.BigFraction}.</em>
-<a class="jxr_linenumber" name="L362" href="#L362">362</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L363" href="#L363">363</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
-<a class="jxr_linenumber" name="L364" href="#L364">364</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L365" href="#L365">365</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
-<a class="jxr_linenumber" name="L366" href="#L366">366</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if algorithm fails to convert {@code h} to a</em>
-<a class="jxr_linenumber" name="L367" href="#L367">367</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
-<a class="jxr_linenumber" name="L368" href="#L368">368</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\)</em>
-<a class="jxr_linenumber" name="L369" href="#L369">369</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L370" href="#L370">370</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> cdf(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
-<a class="jxr_linenumber" name="L371" href="#L371">371</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
-<a class="jxr_linenumber" name="L372" href="#L372">372</a>         <strong class="jxr_keyword">return</strong> cdf(d, n, false);
-<a class="jxr_linenumber" name="L373" href="#L373">373</a>     }
-<a class="jxr_linenumber" name="L374" href="#L374">374</a> 
-<a class="jxr_linenumber" name="L375" href="#L375">375</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L376" href="#L376">376</a> <em class="jxr_javadoccomment">     * Calculates {@code P(D_n &lt; d)}. The result is exact in the sense that BigFraction/BigReal is</em>
-<a class="jxr_linenumber" name="L377" href="#L377">377</a> <em class="jxr_javadoccomment">     * used everywhere at the expense of very slow execution time. Almost never choose this in real</em>
-<a class="jxr_linenumber" name="L378" href="#L378">378</a> <em class="jxr_javadoccomment">     * applications unless you are very sure; this is almost solely for verification purposes.</em>
-<a class="jxr_linenumber" name="L379" href="#L379">379</a> <em class="jxr_javadoccomment">     * Normally, you would choose {@link #cdf(double, int)}. See the class</em>
-<a class="jxr_linenumber" name="L380" href="#L380">380</a> <em class="jxr_javadoccomment">     * javadoc for definitions and algorithm description.</em>
-<a class="jxr_linenumber" name="L381" href="#L381">381</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L382" href="#L382">382</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
-<a class="jxr_linenumber" name="L383" href="#L383">383</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L384" href="#L384">384</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
-<a class="jxr_linenumber" name="L385" href="#L385">385</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if the algorithm fails to convert {@code h} to a</em>
-<a class="jxr_linenumber" name="L386" href="#L386">386</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
-<a class="jxr_linenumber" name="L387" href="#L387">387</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\)</em>
-<a class="jxr_linenumber" name="L388" href="#L388">388</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L389" href="#L389">389</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> cdfExact(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
-<a class="jxr_linenumber" name="L390" href="#L390">390</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
-<a class="jxr_linenumber" name="L391" href="#L391">391</a>         <strong class="jxr_keyword">return</strong> cdf(d, n, <strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="L392" href="#L392">392</a>     }
-<a class="jxr_linenumber" name="L393" href="#L393">393</a> 
-<a class="jxr_linenumber" name="L394" href="#L394">394</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L395" href="#L395">395</a> <em class="jxr_javadoccomment">     * Calculates {@code P(D_n &lt; d)} using method described in [1] with quick decisions for extreme</em>
-<a class="jxr_linenumber" name="L396" href="#L396">396</a> <em class="jxr_javadoccomment">     * values given in [2] (see above).</em>
-<a class="jxr_linenumber" name="L397" href="#L397">397</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L398" href="#L398">398</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
-<a class="jxr_linenumber" name="L399" href="#L399">399</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L400" href="#L400">400</a> <em class="jxr_javadoccomment">     * @param exact whether the probability should be calculated exact using</em>
-<a class="jxr_linenumber" name="L401" href="#L401">401</a> <em class="jxr_javadoccomment">     *        {@link org.apache.commons.math3.fraction.BigFraction} everywhere at the expense of</em>
-<a class="jxr_linenumber" name="L402" href="#L402">402</a> <em class="jxr_javadoccomment">     *        very slow execution time, or if {@code double} should be used convenient places to</em>
-<a class="jxr_linenumber" name="L403" href="#L403">403</a> <em class="jxr_javadoccomment">     *        gain speed. Almost never choose {@code true} in real applications unless you are very</em>
-<a class="jxr_linenumber" name="L404" href="#L404">404</a> <em class="jxr_javadoccomment">     *        sure; {@code true} is almost solely for verification purposes.</em>
-<a class="jxr_linenumber" name="L405" href="#L405">405</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
-<a class="jxr_linenumber" name="L406" href="#L406">406</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if algorithm fails to convert {@code h} to a</em>
-<a class="jxr_linenumber" name="L407" href="#L407">407</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
-<a class="jxr_linenumber" name="L408" href="#L408">408</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\).</em>
-<a class="jxr_linenumber" name="L409" href="#L409">409</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L410" href="#L410">410</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> cdf(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n, <strong class="jxr_keyword">boolean</strong> exact)
-<a class="jxr_linenumber" name="L411" href="#L411">411</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
-<a class="jxr_linenumber" name="L412" href="#L412">412</a> 
-<a class="jxr_linenumber" name="L413" href="#L413">413</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> ninv = 1 / ((<strong class="jxr_keyword">double</strong>) n);
-<a class="jxr_linenumber" name="L414" href="#L414">414</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> ninvhalf = 0.5 * ninv;
-<a class="jxr_linenumber" name="L415" href="#L415">415</a> 
-<a class="jxr_linenumber" name="L416" href="#L416">416</a>         <strong class="jxr_keyword">if</strong> (d &lt;= ninvhalf) {
-<a class="jxr_linenumber" name="L417" href="#L417">417</a>             <strong class="jxr_keyword">return</strong> 0;
-<a class="jxr_linenumber" name="L418" href="#L418">418</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (ninvhalf &lt; d &amp;&amp; d &lt;= ninv) {
-<a class="jxr_linenumber" name="L419" href="#L419">419</a>             <strong class="jxr_keyword">double</strong> res = 1;
-<a class="jxr_linenumber" name="L420" href="#L420">420</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> f = 2 * d - ninv;
-<a class="jxr_linenumber" name="L421" href="#L421">421</a>             <em class="jxr_comment">// n! f^n = n*f * (n-1)*f * ... * 1*x</em>
-<a class="jxr_linenumber" name="L422" href="#L422">422</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt;= n; ++i) {
-<a class="jxr_linenumber" name="L423" href="#L423">423</a>                 res *= i * f;
-<a class="jxr_linenumber" name="L424" href="#L424">424</a>             }
-<a class="jxr_linenumber" name="L425" href="#L425">425</a>             <strong class="jxr_keyword">return</strong> res;
-<a class="jxr_linenumber" name="L426" href="#L426">426</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (1 - ninv &lt;= d &amp;&amp; d &lt; 1) {
-<a class="jxr_linenumber" name="L427" href="#L427">427</a>             <strong class="jxr_keyword">return</strong> 1 - 2 * Math.pow(1 - d, n);
-<a class="jxr_linenumber" name="L428" href="#L428">428</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (1 &lt;= d) {
-<a class="jxr_linenumber" name="L429" href="#L429">429</a>             <strong class="jxr_keyword">return</strong> 1;
-<a class="jxr_linenumber" name="L430" href="#L430">430</a>         }
-<a class="jxr_linenumber" name="L431" href="#L431">431</a>         <strong class="jxr_keyword">if</strong> (exact) {
-<a class="jxr_linenumber" name="L432" href="#L432">432</a>             <strong class="jxr_keyword">return</strong> exactK(d,n);
-<a class="jxr_linenumber" name="L433" href="#L433">433</a>         }
-<a class="jxr_linenumber" name="L434" href="#L434">434</a>         <strong class="jxr_keyword">if</strong> (n &lt;= 140) {
-<a class="jxr_linenumber" name="L435" href="#L435">435</a>             <strong class="jxr_keyword">return</strong> roundedK(d, n);
-<a class="jxr_linenumber" name="L436" href="#L436">436</a>         }
-<a class="jxr_linenumber" name="L437" href="#L437">437</a>         <strong class="jxr_keyword">return</strong> pelzGood(d, n);
-<a class="jxr_linenumber" name="L438" href="#L438">438</a>     }
-<a class="jxr_linenumber" name="L439" href="#L439">439</a> 
-<a class="jxr_linenumber" name="L440" href="#L440">440</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L441" href="#L441">441</a> <em class="jxr_javadoccomment">     * Calculates the exact value of {@code P(D_n &lt; d)} using the method described in [1] (reference</em>
-<a class="jxr_linenumber" name="L442" href="#L442">442</a> <em class="jxr_javadoccomment">     * in class javadoc above) and {@link org.apache.commons.math3.fraction.BigFraction} (see</em>
-<a class="jxr_linenumber" name="L443" href="#L443">443</a> <em class="jxr_javadoccomment">     * above).</em>
-<a class="jxr_linenumber" name="L444" href="#L444">444</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L445" href="#L445">445</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
-<a class="jxr_linenumber" name="L446" href="#L446">446</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L447" href="#L447">447</a> <em class="jxr_javadoccomment">     * @return the two-sided probability of \(P(D_n &lt; d)\)</em>
-<a class="jxr_linenumber" name="L448" href="#L448">448</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if algorithm fails to convert {@code h} to a</em>
-<a class="jxr_linenumber" name="L449" href="#L449">449</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
-<a class="jxr_linenumber" name="L450" href="#L450">450</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\).</em>
-<a class="jxr_linenumber" name="L451" href="#L451">451</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L452" href="#L452">452</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">double</strong> exactK(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
-<a class="jxr_linenumber" name="L453" href="#L453">453</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
-<a class="jxr_linenumber" name="L454" href="#L454">454</a> 
-<a class="jxr_linenumber" name="L455" href="#L455">455</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> k = (<strong class="jxr_keyword">int</strong>) Math.ceil(n * d);
-<a class="jxr_linenumber" name="L456" href="#L456">456</a> 
-<a class="jxr_linenumber" name="L457" href="#L457">457</a>         <strong class="jxr_keyword">final</strong> FieldMatrix&lt;BigFraction&gt; H = <strong class="jxr_keyword">this</strong>.createExactH(d, n);
-<a class="jxr_linenumber" name="L458" href="#L458">458</a>         <strong class="jxr_keyword">final</strong> FieldMatrix&lt;BigFraction&gt; Hpower = H.power(n);
-<a class="jxr_linenumber" name="L459" href="#L459">459</a> 
-<a class="jxr_linenumber" name="L460" href="#L460">460</a>         <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a> pFrac = Hpower.getEntry(k - 1, k - 1);
-<a class="jxr_linenumber" name="L461" href="#L461">461</a> 
-<a class="jxr_linenumber" name="L462" href="#L462">462</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt;= n; ++i) {
-<a class="jxr_linenumber" name="L463" href="#L463">463</a>             pFrac = pFrac.multiply(i).divide(n);
-<a class="jxr_linenumber" name="L464" href="#L464">464</a>         }
+<a class="jxr_linenumber" name="L301" href="#L301">301</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> x_i = sx[i];
+<a class="jxr_linenumber" name="L302" href="#L302">302</a>             <em class="jxr_comment">// ties can be safely ignored</em>
+<a class="jxr_linenumber" name="L303" href="#L303">303</a>             <strong class="jxr_keyword">if</strong> (i &gt; 0 &amp;&amp; x_i == sx[i-1]) {
+<a class="jxr_linenumber" name="L304" href="#L304">304</a>                 <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="L305" href="#L305">305</a>             }
+<a class="jxr_linenumber" name="L306" href="#L306">306</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_x = edf(x_i, sx);
+<a class="jxr_linenumber" name="L307" href="#L307">307</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_y = edf(x_i, sy);
+<a class="jxr_linenumber" name="L308" href="#L308">308</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> curD = FastMath.abs(cdf_x - cdf_y);
+<a class="jxr_linenumber" name="L309" href="#L309">309</a>             <strong class="jxr_keyword">if</strong> (curD &gt; supD) {
+<a class="jxr_linenumber" name="L310" href="#L310">310</a>                 supD = curD;
+<a class="jxr_linenumber" name="L311" href="#L311">311</a>             }
+<a class="jxr_linenumber" name="L312" href="#L312">312</a>         }
+<a class="jxr_linenumber" name="L313" href="#L313">313</a>         <em class="jxr_comment">// Now look at y</em>
+<a class="jxr_linenumber" name="L314" href="#L314">314</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; m; i++) {
+<a class="jxr_linenumber" name="L315" href="#L315">315</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> y_i = sy[i];
+<a class="jxr_linenumber" name="L316" href="#L316">316</a>             <em class="jxr_comment">// ties can be safely ignored</em>
+<a class="jxr_linenumber" name="L317" href="#L317">317</a>             <strong class="jxr_keyword">if</strong> (i &gt; 0 &amp;&amp; y_i == sy[i-1]) {
+<a class="jxr_linenumber" name="L318" href="#L318">318</a>                 <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="L319" href="#L319">319</a>             }
+<a class="jxr_linenumber" name="L320" href="#L320">320</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_x = edf(y_i, sx);
+<a class="jxr_linenumber" name="L321" href="#L321">321</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> cdf_y = edf(y_i, sy);
+<a class="jxr_linenumber" name="L322" href="#L322">322</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> curD = FastMath.abs(cdf_x - cdf_y);
+<a class="jxr_linenumber" name="L323" href="#L323">323</a>             <strong class="jxr_keyword">if</strong> (curD &gt; supD) {
+<a class="jxr_linenumber" name="L324" href="#L324">324</a>                 supD = curD;
+<a class="jxr_linenumber" name="L325" href="#L325">325</a>             }
+<a class="jxr_linenumber" name="L326" href="#L326">326</a>         }
+<a class="jxr_linenumber" name="L327" href="#L327">327</a>         <strong class="jxr_keyword">return</strong> supD;
+<a class="jxr_linenumber" name="L328" href="#L328">328</a>     }
+<a class="jxr_linenumber" name="L329" href="#L329">329</a> 
+<a class="jxr_linenumber" name="L330" href="#L330">330</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L331" href="#L331">331</a> <em class="jxr_javadoccomment">     * Computes the empirical distribution function.</em>
+<a class="jxr_linenumber" name="L332" href="#L332">332</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L333" href="#L333">333</a> <em class="jxr_javadoccomment">     * @param x the given x</em>
+<a class="jxr_linenumber" name="L334" href="#L334">334</a> <em class="jxr_javadoccomment">     * @param samples the observations</em>
+<a class="jxr_linenumber" name="L335" href="#L335">335</a> <em class="jxr_javadoccomment">     * @return the empirical distribution function \(F_n(x)\)</em>
+<a class="jxr_linenumber" name="L336" href="#L336">336</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L337" href="#L337">337</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">double</strong> edf(<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> x, <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] samples) {
+<a class="jxr_linenumber" name="L338" href="#L338">338</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> n = samples.length;
+<a class="jxr_linenumber" name="L339" href="#L339">339</a>         <strong class="jxr_keyword">int</strong> index = Arrays.binarySearch(samples, x);
+<a class="jxr_linenumber" name="L340" href="#L340">340</a>         <strong class="jxr_keyword">if</strong> (index &gt;= 0) {
+<a class="jxr_linenumber" name="L341" href="#L341">341</a>             <strong class="jxr_keyword">while</strong>(index &lt; (n - 1) &amp;&amp; samples[index+1] == x) {
+<a class="jxr_linenumber" name="L342" href="#L342">342</a>                 ++index;
+<a class="jxr_linenumber" name="L343" href="#L343">343</a>             }
+<a class="jxr_linenumber" name="L344" href="#L344">344</a>         }
+<a class="jxr_linenumber" name="L345" href="#L345">345</a>         <strong class="jxr_keyword">return</strong> index &gt;= 0 ? (index + 1d) / n : (-index - 1d) / n;
+<a class="jxr_linenumber" name="L346" href="#L346">346</a>     }
+<a class="jxr_linenumber" name="L347" href="#L347">347</a> 
+<a class="jxr_linenumber" name="L348" href="#L348">348</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L349" href="#L349">349</a> <em class="jxr_javadoccomment">     * Computes the &lt;i&gt;p-value&lt;/i&gt;, or &lt;i&gt;observed significance level&lt;/i&gt;, of a one-sample &lt;a</em>
+<a class="jxr_linenumber" name="L350" href="#L350">350</a> <em class="jxr_javadoccomment">     * href="<a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test" target="alexandria_uri">http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test</a>"&gt; Kolmogorov-Smirnov test&lt;/a&gt;</em>
+<a class="jxr_linenumber" name="L351" href="#L351">351</a> <em class="jxr_javadoccomment">     * evaluating the null hypothesis that {@code data} conforms to {@code distribution}.</em>
+<a class="jxr_linenumber" name="L352" href="#L352">352</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L353" href="#L353">353</a> <em class="jxr_javadoccomment">     * @param distribution reference distribution</em>
+<a class="jxr_linenumber" name="L354" href="#L354">354</a> <em class="jxr_javadoccomment">     * @param data sample being being evaluated</em>
+<a class="jxr_linenumber" name="L355" href="#L355">355</a> <em class="jxr_javadoccomment">     * @return the p-value associated with the null hypothesis that {@code data} is a sample from</em>
+<a class="jxr_linenumber" name="L356" href="#L356">356</a> <em class="jxr_javadoccomment">     *         {@code distribution}</em>
+<a class="jxr_linenumber" name="L357" href="#L357">357</a> <em class="jxr_javadoccomment">     * @throws InsufficientDataException if {@code data} does not have length at least 2</em>
+<a class="jxr_linenumber" name="L358" href="#L358">358</a> <em class="jxr_javadoccomment">     * @throws NullArgumentException if {@code data} is null</em>
+<a class="jxr_linenumber" name="L359" href="#L359">359</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L360" href="#L360">360</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html">RealDistribution</a> distribution, <strong class="jxr_keyword">double</strong>[] data) {
+<a class="jxr_linenumber" name="L361" href="#L361">361</a>         <strong class="jxr_keyword">return</strong> kolmogorovSmirnovTest(distribution, data, false);
+<a class="jxr_linenumber" name="L362" href="#L362">362</a>     }
+<a class="jxr_linenumber" name="L363" href="#L363">363</a> 
+<a class="jxr_linenumber" name="L364" href="#L364">364</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L365" href="#L365">365</a> <em class="jxr_javadoccomment">     * Performs a &lt;a href="<a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test" target="alexandria_uri">http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test</a>"&gt; Kolmogorov-Smirnov</em>
+<a class="jxr_linenumber" name="L366" href="#L366">366</a> <em class="jxr_javadoccomment">     * test&lt;/a&gt; evaluating the null hypothesis that {@code data} conforms to {@code distribution}.</em>
+<a class="jxr_linenumber" name="L367" href="#L367">367</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L368" href="#L368">368</a> <em class="jxr_javadoccomment">     * @param distribution reference distribution</em>
+<a class="jxr_linenumber" name="L369" href="#L369">369</a> <em class="jxr_javadoccomment">     * @param data sample being being evaluated</em>
+<a class="jxr_linenumber" name="L370" href="#L370">370</a> <em class="jxr_javadoccomment">     * @param alpha significance level of the test</em>
+<a class="jxr_linenumber" name="L371" href="#L371">371</a> <em class="jxr_javadoccomment">     * @return true iff the null hypothesis that {@code data} is a sample from {@code distribution}</em>
+<a class="jxr_linenumber" name="L372" href="#L372">372</a> <em class="jxr_javadoccomment">     *         can be rejected with confidence 1 - {@code alpha}</em>
+<a class="jxr_linenumber" name="L373" href="#L373">373</a> <em class="jxr_javadoccomment">     * @throws InsufficientDataException if {@code data} does not have length at least 2</em>
+<a class="jxr_linenumber" name="L374" href="#L374">374</a> <em class="jxr_javadoccomment">     * @throws NullArgumentException if {@code data} is null</em>
+<a class="jxr_linenumber" name="L375" href="#L375">375</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L376" href="#L376">376</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> kolmogorovSmirnovTest(<a href="../../../../../../org/apache/commons/math3/distribution/RealDistribution.html">RealDistribution</a> distribution, <strong class="jxr_keyword">double</strong>[] data, <strong class="jxr_keyword">double</strong> alpha) {
+<a class="jxr_linenumber" name="L377" href="#L377">377</a>         <strong class="jxr_keyword">if</strong> ((alpha &lt;= 0) || (alpha &gt; 0.5)) {
+<a class="jxr_linenumber" name="L378" href="#L378">378</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/OutOfRangeException.html">OutOfRangeException</a>(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL, alpha, 0, 0.5);
+<a class="jxr_linenumber" name="L379" href="#L379">379</a>         }
+<a class="jxr_linenumber" name="L380" href="#L380">380</a>         <strong class="jxr_keyword">return</strong> kolmogorovSmirnovTest(distribution, data) &lt; alpha;
+<a class="jxr_linenumber" name="L381" href="#L381">381</a>     }
+<a class="jxr_linenumber" name="L382" href="#L382">382</a> 
+<a class="jxr_linenumber" name="L383" href="#L383">383</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L384" href="#L384">384</a> <em class="jxr_javadoccomment">     * Calculates \(P(D_n &lt; d)\) using the method described in [1] with quick decisions for extreme</em>
+<a class="jxr_linenumber" name="L385" href="#L385">385</a> <em class="jxr_javadoccomment">     * values given in [2] (see above). The result is not exact as with</em>
+<a class="jxr_linenumber" name="L386" href="#L386">386</a> <em class="jxr_javadoccomment">     * {@link #cdfExact(double, int)} because calculations are based on</em>
+<a class="jxr_linenumber" name="L387" href="#L387">387</a> <em class="jxr_javadoccomment">     * {@code double} rather than {@link org.apache.commons.math3.fraction.BigFraction}.</em>
+<a class="jxr_linenumber" name="L388" href="#L388">388</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L389" href="#L389">389</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
+<a class="jxr_linenumber" name="L390" href="#L390">390</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
+<a class="jxr_linenumber" name="L391" href="#L391">391</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
+<a class="jxr_linenumber" name="L392" href="#L392">392</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if algorithm fails to convert {@code h} to a</em>
+<a class="jxr_linenumber" name="L393" href="#L393">393</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
+<a class="jxr_linenumber" name="L394" href="#L394">394</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\)</em>
+<a class="jxr_linenumber" name="L395" href="#L395">395</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L396" href="#L396">396</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> cdf(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
+<a class="jxr_linenumber" name="L397" href="#L397">397</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
+<a class="jxr_linenumber" name="L398" href="#L398">398</a>         <strong class="jxr_keyword">return</strong> cdf(d, n, false);
+<a class="jxr_linenumber" name="L399" href="#L399">399</a>     }
+<a class="jxr_linenumber" name="L400" href="#L400">400</a> 
+<a class="jxr_linenumber" name="L401" href="#L401">401</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L402" href="#L402">402</a> <em class="jxr_javadoccomment">     * Calculates {@code P(D_n &lt; d)}. The result is exact in the sense that BigFraction/BigReal is</em>
+<a class="jxr_linenumber" name="L403" href="#L403">403</a> <em class="jxr_javadoccomment">     * used everywhere at the expense of very slow execution time. Almost never choose this in real</em>
+<a class="jxr_linenumber" name="L404" href="#L404">404</a> <em class="jxr_javadoccomment">     * applications unless you are very sure; this is almost solely for verification purposes.</em>
+<a class="jxr_linenumber" name="L405" href="#L405">405</a> <em class="jxr_javadoccomment">     * Normally, you would choose {@link #cdf(double, int)}. See the class</em>
+<a class="jxr_linenumber" name="L406" href="#L406">406</a> <em class="jxr_javadoccomment">     * javadoc for definitions and algorithm description.</em>
+<a class="jxr_linenumber" name="L407" href="#L407">407</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L408" href="#L408">408</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
+<a class="jxr_linenumber" name="L409" href="#L409">409</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
+<a class="jxr_linenumber" name="L410" href="#L410">410</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
+<a class="jxr_linenumber" name="L411" href="#L411">411</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if the algorithm fails to convert {@code h} to a</em>
+<a class="jxr_linenumber" name="L412" href="#L412">412</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
+<a class="jxr_linenumber" name="L413" href="#L413">413</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\)</em>
+<a class="jxr_linenumber" name="L414" href="#L414">414</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L415" href="#L415">415</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> cdfExact(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
+<a class="jxr_linenumber" name="L416" href="#L416">416</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
+<a class="jxr_linenumber" name="L417" href="#L417">417</a>         <strong class="jxr_keyword">return</strong> cdf(d, n, <strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="L418" href="#L418">418</a>     }
+<a class="jxr_linenumber" name="L419" href="#L419">419</a> 
+<a class="jxr_linenumber" name="L420" href="#L420">420</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L421" href="#L421">421</a> <em class="jxr_javadoccomment">     * Calculates {@code P(D_n &lt; d)} using method described in [1] with quick decisions for extreme</em>
+<a class="jxr_linenumber" name="L422" href="#L422">422</a> <em class="jxr_javadoccomment">     * values given in [2] (see above).</em>
+<a class="jxr_linenumber" name="L423" href="#L423">423</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L424" href="#L424">424</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
+<a class="jxr_linenumber" name="L425" href="#L425">425</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
+<a class="jxr_linenumber" name="L426" href="#L426">426</a> <em class="jxr_javadoccomment">     * @param exact whether the probability should be calculated exact using</em>
+<a class="jxr_linenumber" name="L427" href="#L427">427</a> <em class="jxr_javadoccomment">     *        {@link org.apache.commons.math3.fraction.BigFraction} everywhere at the expense of</em>
+<a class="jxr_linenumber" name="L428" href="#L428">428</a> <em class="jxr_javadoccomment">     *        very slow execution time, or if {@code double} should be used convenient places to</em>
+<a class="jxr_linenumber" name="L429" href="#L429">429</a> <em class="jxr_javadoccomment">     *        gain speed. Almost never choose {@code true} in real applications unless you are very</em>
+<a class="jxr_linenumber" name="L430" href="#L430">430</a> <em class="jxr_javadoccomment">     *        sure; {@code true} is almost solely for verification purposes.</em>
+<a class="jxr_linenumber" name="L431" href="#L431">431</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
+<a class="jxr_linenumber" name="L432" href="#L432">432</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if algorithm fails to convert {@code h} to a</em>
+<a class="jxr_linenumber" name="L433" href="#L433">433</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
+<a class="jxr_linenumber" name="L434" href="#L434">434</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\).</em>
+<a class="jxr_linenumber" name="L435" href="#L435">435</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L436" href="#L436">436</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> cdf(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n, <strong class="jxr_keyword">boolean</strong> exact)
+<a class="jxr_linenumber" name="L437" href="#L437">437</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
+<a class="jxr_linenumber" name="L438" href="#L438">438</a> 
+<a class="jxr_linenumber" name="L439" href="#L439">439</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> ninv = 1 / ((<strong class="jxr_keyword">double</strong>) n);
+<a class="jxr_linenumber" name="L440" href="#L440">440</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> ninvhalf = 0.5 * ninv;
+<a class="jxr_linenumber" name="L441" href="#L441">441</a> 
+<a class="jxr_linenumber" name="L442" href="#L442">442</a>         <strong class="jxr_keyword">if</strong> (d &lt;= ninvhalf) {
+<a class="jxr_linenumber" name="L443" href="#L443">443</a>             <strong class="jxr_keyword">return</strong> 0;
+<a class="jxr_linenumber" name="L444" href="#L444">444</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (ninvhalf &lt; d &amp;&amp; d &lt;= ninv) {
+<a class="jxr_linenumber" name="L445" href="#L445">445</a>             <strong class="jxr_keyword">double</strong> res = 1;
+<a class="jxr_linenumber" name="L446" href="#L446">446</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> f = 2 * d - ninv;
+<a class="jxr_linenumber" name="L447" href="#L447">447</a>             <em class="jxr_comment">// n! f^n = n*f * (n-1)*f * ... * 1*x</em>
+<a class="jxr_linenumber" name="L448" href="#L448">448</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt;= n; ++i) {
+<a class="jxr_linenumber" name="L449" href="#L449">449</a>                 res *= i * f;
+<a class="jxr_linenumber" name="L450" href="#L450">450</a>             }
+<a class="jxr_linenumber" name="L451" href="#L451">451</a>             <strong class="jxr_keyword">return</strong> res;
+<a class="jxr_linenumber" name="L452" href="#L452">452</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (1 - ninv &lt;= d &amp;&amp; d &lt; 1) {
+<a class="jxr_linenumber" name="L453" href="#L453">453</a>             <strong class="jxr_keyword">return</strong> 1 - 2 * Math.pow(1 - d, n);
+<a class="jxr_linenumber" name="L454" href="#L454">454</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (1 &lt;= d) {
+<a class="jxr_linenumber" name="L455" href="#L455">455</a>             <strong class="jxr_keyword">return</strong> 1;
+<a class="jxr_linenumber" name="L456" href="#L456">456</a>         }
+<a class="jxr_linenumber" name="L457" href="#L457">457</a>         <strong class="jxr_keyword">if</strong> (exact) {
+<a class="jxr_linenumber" name="L458" href="#L458">458</a>             <strong class="jxr_keyword">return</strong> exactK(d, n);
+<a class="jxr_linenumber" name="L459" href="#L459">459</a>         }
+<a class="jxr_linenumber" name="L460" href="#L460">460</a>         <strong class="jxr_keyword">if</strong> (n &lt;= 140) {
+<a class="jxr_linenumber" name="L461" href="#L461">461</a>             <strong class="jxr_keyword">return</strong> roundedK(d, n);
+<a class="jxr_linenumber" name="L462" href="#L462">462</a>         }
+<a class="jxr_linenumber" name="L463" href="#L463">463</a>         <strong class="jxr_keyword">return</strong> pelzGood(d, n);
+<a class="jxr_linenumber" name="L464" href="#L464">464</a>     }
 <a class="jxr_linenumber" name="L465" href="#L465">465</a> 
-<a class="jxr_linenumber" name="L466" href="#L466">466</a>         <em class="jxr_comment">/*</em>
-<a class="jxr_linenumber" name="L467" href="#L467">467</a> <em class="jxr_comment">         * BigFraction.doubleValue converts numerator to double and the denominator to double and</em>
-<a class="jxr_linenumber" name="L468" href="#L468">468</a> <em class="jxr_comment">         * divides afterwards. That gives NaN quite easy. This does not (scale is the number of</em>
-<a class="jxr_linenumber" name="L469" href="#L469">469</a> <em class="jxr_comment">         * digits):</em>
-<a class="jxr_linenumber" name="L470" href="#L470">470</a> <em class="jxr_comment">         */</em>
-<a class="jxr_linenumber" name="L471" href="#L471">471</a>         <strong class="jxr_keyword">return</strong> pFrac.bigDecimalValue(20, BigDecimal.ROUND_HALF_UP).doubleValue();
-<a class="jxr_linenumber" name="L472" href="#L472">472</a>     }
-<a class="jxr_linenumber" name="L473" href="#L473">473</a> 
-<a class="jxr_linenumber" name="L474" href="#L474">474</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L475" href="#L475">475</a> <em class="jxr_javadoccomment">     * Calculates {@code P(D_n &lt; d)} using method described in [1] and doubles (see above).</em>
-<a class="jxr_linenumber" name="L476" href="#L476">476</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L477" href="#L477">477</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
-<a class="jxr_linenumber" name="L478" href="#L478">478</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L479" href="#L479">479</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
-<a class="jxr_linenumber" name="L480" href="#L480">480</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L481" href="#L481">481</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">double</strong> roundedK(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n) {
+<a class="jxr_linenumber" name="L466" href="#L466">466</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L467" href="#L467">467</a> <em class="jxr_javadoccomment">     * Calculates the exact value of {@code P(D_n &lt; d)} using the method described in [1] (reference</em>
+<a class="jxr_linenumber" name="L468" href="#L468">468</a> <em class="jxr_javadoccomment">     * in class javadoc above) and {@link org.apache.commons.math3.fraction.BigFraction} (see</em>
+<a class="jxr_linenumber" name="L469" href="#L469">469</a> <em class="jxr_javadoccomment">     * above).</em>
+<a class="jxr_linenumber" name="L470" href="#L470">470</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L471" href="#L471">471</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
+<a class="jxr_linenumber" name="L472" href="#L472">472</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
+<a class="jxr_linenumber" name="L473" href="#L473">473</a> <em class="jxr_javadoccomment">     * @return the two-sided probability of \(P(D_n &lt; d)\)</em>
+<a class="jxr_linenumber" name="L474" href="#L474">474</a> <em class="jxr_javadoccomment">     * @throws MathArithmeticException if algorithm fails to convert {@code h} to a</em>
+<a class="jxr_linenumber" name="L475" href="#L475">475</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
+<a class="jxr_linenumber" name="L476" href="#L476">476</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 \le h &lt; 1\).</em>
+<a class="jxr_linenumber" name="L477" href="#L477">477</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L478" href="#L478">478</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">double</strong> exactK(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
+<a class="jxr_linenumber" name="L479" href="#L479">479</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/commons/math3/exception/MathArithmeticException.html">MathArithmeticException</a> {
+<a class="jxr_linenumber" name="L480" href="#L480">480</a> 
+<a class="jxr_linenumber" name="L481" href="#L481">481</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> k = (<strong class="jxr_keyword">int</strong>) Math.ceil(n * d);
 <a class="jxr_linenumber" name="L482" href="#L482">482</a> 
-<a class="jxr_linenumber" name="L483" href="#L483">483</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> k = (<strong class="jxr_keyword">int</strong>) Math.ceil(n * d);
-<a class="jxr_linenumber" name="L484" href="#L484">484</a>         <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> H = <strong class="jxr_keyword">this</strong>.createRoundedH(d, n);
-<a class="jxr_linenumber" name="L485" href="#L485">485</a>         <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> Hpower = H.power(n);
-<a class="jxr_linenumber" name="L486" href="#L486">486</a> 
-<a class="jxr_linenumber" name="L487" href="#L487">487</a>         <strong class="jxr_keyword">double</strong> pFrac = Hpower.getEntry(k - 1, k - 1);
+<a class="jxr_linenumber" name="L483" href="#L483">483</a>         <strong class="jxr_keyword">final</strong> FieldMatrix&lt;BigFraction&gt; H = <strong class="jxr_keyword">this</strong>.createExactH(d, n);
+<a class="jxr_linenumber" name="L484" href="#L484">484</a>         <strong class="jxr_keyword">final</strong> FieldMatrix&lt;BigFraction&gt; Hpower = H.power(n);
+<a class="jxr_linenumber" name="L485" href="#L485">485</a> 
+<a class="jxr_linenumber" name="L486" href="#L486">486</a>         <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a> pFrac = Hpower.getEntry(k - 1, k - 1);
+<a class="jxr_linenumber" name="L487" href="#L487">487</a> 
 <a class="jxr_linenumber" name="L488" href="#L488">488</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt;= n; ++i) {
-<a class="jxr_linenumber" name="L489" href="#L489">489</a>             pFrac *= (<strong class="jxr_keyword">double</strong>) i / (<strong class="jxr_keyword">double</strong>) n;
+<a class="jxr_linenumber" name="L489" href="#L489">489</a>             pFrac = pFrac.multiply(i).divide(n);
 <a class="jxr_linenumber" name="L490" href="#L490">490</a>         }
 <a class="jxr_linenumber" name="L491" href="#L491">491</a> 
-<a class="jxr_linenumber" name="L492" href="#L492">492</a>         <strong class="jxr_keyword">return</strong> pFrac;
-<a class="jxr_linenumber" name="L493" href="#L493">493</a>     }
-<a class="jxr_linenumber" name="L494" href="#L494">494</a> 
-<a class="jxr_linenumber" name="L495" href="#L495">495</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L496" href="#L496">496</a> <em class="jxr_javadoccomment">     * Computes the Pelz-Good approximation for \(P(D_n &lt; d)\) as described in [2] in the class javadoc.</em>
-<a class="jxr_linenumber" name="L497" href="#L497">497</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L498" href="#L498">498</a> <em class="jxr_javadoccomment">     * @param d value of d-statistic (x in [2])</em>
-<a class="jxr_linenumber" name="L499" href="#L499">499</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L500" href="#L500">500</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
-<a class="jxr_linenumber" name="L501" href="#L501">501</a> <em class="jxr_javadoccomment">     * @since 3.4</em>
-<a class="jxr_linenumber" name="L502" href="#L502">502</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L503" href="#L503">503</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> pelzGood(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n) {
-<a class="jxr_linenumber" name="L504" href="#L504">504</a> 
-<a class="jxr_linenumber" name="L505" href="#L505">505</a>         <em class="jxr_comment">// Change the variable since approximation is for the distribution evaluated at d / sqrt(n)</em>
-<a class="jxr_linenumber" name="L506" href="#L506">506</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> sqrtN = FastMath.sqrt(n);
-<a class="jxr_linenumber" name="L507" href="#L507">507</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z = d * sqrtN;
-<a class="jxr_linenumber" name="L508" href="#L508">508</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z2 = d * d * n;
-<a class="jxr_linenumber" name="L509" href="#L509">509</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z4 = z2 * z2;
-<a class="jxr_linenumber" name="L510" href="#L510">510</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z6 = z4 * z2;
-<a class="jxr_linenumber" name="L511" href="#L511">511</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z8 = z4 * z4;
+<a class="jxr_linenumber" name="L492" href="#L492">492</a>         <em class="jxr_comment">/*</em>
+<a class="jxr_linenumber" name="L493" href="#L493">493</a> <em class="jxr_comment">         * BigFraction.doubleValue converts numerator to double and the denominator to double and</em>
+<a class="jxr_linenumber" name="L494" href="#L494">494</a> <em class="jxr_comment">         * divides afterwards. That gives NaN quite easy. This does not (scale is the number of</em>
+<a class="jxr_linenumber" name="L495" href="#L495">495</a> <em class="jxr_comment">         * digits):</em>
+<a class="jxr_linenumber" name="L496" href="#L496">496</a> <em class="jxr_comment">         */</em>
+<a class="jxr_linenumber" name="L497" href="#L497">497</a>         <strong class="jxr_keyword">return</strong> pFrac.bigDecimalValue(20, BigDecimal.ROUND_HALF_UP).doubleValue();
+<a class="jxr_linenumber" name="L498" href="#L498">498</a>     }
+<a class="jxr_linenumber" name="L499" href="#L499">499</a> 
+<a class="jxr_linenumber" name="L500" href="#L500">500</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L501" href="#L501">501</a> <em class="jxr_javadoccomment">     * Calculates {@code P(D_n &lt; d)} using method described in [1] and doubles (see above).</em>
+<a class="jxr_linenumber" name="L502" href="#L502">502</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L503" href="#L503">503</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
+<a class="jxr_linenumber" name="L504" href="#L504">504</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
+<a class="jxr_linenumber" name="L505" href="#L505">505</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
+<a class="jxr_linenumber" name="L506" href="#L506">506</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L507" href="#L507">507</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">double</strong> roundedK(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n) {
+<a class="jxr_linenumber" name="L508" href="#L508">508</a> 
+<a class="jxr_linenumber" name="L509" href="#L509">509</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> k = (<strong class="jxr_keyword">int</strong>) Math.ceil(n * d);
+<a class="jxr_linenumber" name="L510" href="#L510">510</a>         <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> H = <strong class="jxr_keyword">this</strong>.createRoundedH(d, n);
+<a class="jxr_linenumber" name="L511" href="#L511">511</a>         <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html">RealMatrix</a> Hpower = H.power(n);
 <a class="jxr_linenumber" name="L512" href="#L512">512</a> 
-<a class="jxr_linenumber" name="L513" href="#L513">513</a>         <em class="jxr_comment">// Eventual return value</em>
-<a class="jxr_linenumber" name="L514" href="#L514">514</a>         <strong class="jxr_keyword">double</strong> ret = 0;
-<a class="jxr_linenumber" name="L515" href="#L515">515</a> 
-<a class="jxr_linenumber" name="L516" href="#L516">516</a>         <em class="jxr_comment">// Compute K_0(z)</em>
-<a class="jxr_linenumber" name="L517" href="#L517">517</a>         <strong class="jxr_keyword">double</strong> sum = 0;
-<a class="jxr_linenumber" name="L518" href="#L518">518</a>         <strong class="jxr_keyword">double</strong> increment = 0;
-<a class="jxr_linenumber" name="L519" href="#L519">519</a>         <strong class="jxr_keyword">double</strong> kTerm = 0;
-<a class="jxr_linenumber" name="L520" href="#L520">520</a>         <strong class="jxr_keyword">double</strong> z2Term = PI_SQUARED / (8 * z2);
-<a class="jxr_linenumber" name="L521" href="#L521">521</a>         <strong class="jxr_keyword">int</strong> k = 1;
-<a class="jxr_linenumber" name="L522" href="#L522">522</a>         <strong class="jxr_keyword">for</strong> (; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
-<a class="jxr_linenumber" name="L523" href="#L523">523</a>             kTerm = 2 * k - 1;
-<a class="jxr_linenumber" name="L524" href="#L524">524</a>             increment = FastMath.exp(-z2Term * kTerm * kTerm);
-<a class="jxr_linenumber" name="L525" href="#L525">525</a>             sum += increment;
-<a class="jxr_linenumber" name="L526" href="#L526">526</a>             <strong class="jxr_keyword">if</strong> (increment &lt;= PG_SUM_RELATIVE_ERROR * sum) {
-<a class="jxr_linenumber" name="L527" href="#L527">527</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L528" href="#L528">528</a>             }
-<a class="jxr_linenumber" name="L529" href="#L529">529</a>         }
-<a class="jxr_linenumber" name="L530" href="#L530">530</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
-<a class="jxr_linenumber" name="L531" href="#L531">531</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
-<a class="jxr_linenumber" name="L532" href="#L532">532</a>         }
-<a class="jxr_linenumber" name="L533" href="#L533">533</a>         ret = sum * FastMath.sqrt(2 * FastMath.PI) / z;
-<a class="jxr_linenumber" name="L534" href="#L534">534</a> 
-<a class="jxr_linenumber" name="L535" href="#L535">535</a>         <em class="jxr_comment">// K_1(z)</em>
-<a class="jxr_linenumber" name="L536" href="#L536">536</a>         <em class="jxr_comment">// Sum is -inf to inf, but k term is always (k + 1/2) ^ 2, so really have</em>
-<a class="jxr_linenumber" name="L537" href="#L537">537</a>         <em class="jxr_comment">// twice the sum from k = 0 to inf (k = -1 is same as 0, -2 same as 1, ...)</em>
-<a class="jxr_linenumber" name="L538" href="#L538">538</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> twoZ2 = 2 * z2;
-<a class="jxr_linenumber" name="L539" href="#L539">539</a>         sum = 0;
-<a class="jxr_linenumber" name="L540" href="#L540">540</a>         kTerm = 0;
-<a class="jxr_linenumber" name="L541" href="#L541">541</a>         <strong class="jxr_keyword">double</strong> kTerm2 = 0;
-<a class="jxr_linenumber" name="L542" href="#L542">542</a>         <strong class="jxr_keyword">for</strong> (k = 0; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
-<a class="jxr_linenumber" name="L543" href="#L543">543</a>             kTerm = k + 0.5;
-<a class="jxr_linenumber" name="L544" href="#L544">544</a>             kTerm2 = kTerm * kTerm;
-<a class="jxr_linenumber" name="L545" href="#L545">545</a>             increment = (PI_SQUARED * kTerm2 - z2) * FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
-<a class="jxr_linenumber" name="L546" href="#L546">546</a>             sum += increment;
-<a class="jxr_linenumber" name="L547" href="#L547">547</a>             <strong class="jxr_keyword">if</strong> (FastMath.abs(increment) &lt; PG_SUM_RELATIVE_ERROR * FastMath.abs(sum)) {
-<a class="jxr_linenumber" name="L548" href="#L548">548</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L549" href="#L549">549</a>             }
-<a class="jxr_linenumber" name="L550" href="#L550">550</a>         }
-<a class="jxr_linenumber" name="L551" href="#L551">551</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
-<a class="jxr_linenumber" name="L552" href="#L552">552</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
-<a class="jxr_linenumber" name="L553" href="#L553">553</a>         }
-<a class="jxr_linenumber" name="L554" href="#L554">554</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> sqrtHalfPi = FastMath.sqrt(PI / 2);
-<a class="jxr_linenumber" name="L555" href="#L555">555</a>         <em class="jxr_comment">// Instead of doubling sum, divide by 3 instead of 6</em>
-<a class="jxr_linenumber" name="L556" href="#L556">556</a>         ret += sum * sqrtHalfPi / (3 * z4 * sqrtN);
-<a class="jxr_linenumber" name="L557" href="#L557">557</a> 
-<a class="jxr_linenumber" name="L558" href="#L558">558</a>         <em class="jxr_comment">// K_2(z)</em>
-<a class="jxr_linenumber" name="L559" href="#L559">559</a>         <em class="jxr_comment">// Same drill as K_1, but with two doubly infinite sums, all k terms are even powers.</em>
-<a class="jxr_linenumber" name="L560" href="#L560">560</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z4Term = 2 * z4;
-<a class="jxr_linenumber" name="L561" href="#L561">561</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z6Term = 6 * z6;
-<a class="jxr_linenumber" name="L562" href="#L562">562</a>         z2Term = 5 * z2;
-<a class="jxr_linenumber" name="L563" href="#L563">563</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> pi4 = PI_SQUARED * PI_SQUARED;
-<a class="jxr_linenumber" name="L564" href="#L564">564</a>         sum = 0;
-<a class="jxr_linenumber" name="L565" href="#L565">565</a>         kTerm = 0;
-<a class="jxr_linenumber" name="L566" href="#L566">566</a>         kTerm2 = 0;
-<a class="jxr_linenumber" name="L567" href="#L567">567</a>         <strong class="jxr_keyword">for</strong> (k = 0; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
-<a class="jxr_linenumber" name="L568" href="#L568">568</a>             kTerm = k + 0.5;
-<a class="jxr_linenumber" name="L569" href="#L569">569</a>             kTerm2 = kTerm * kTerm;
-<a class="jxr_linenumber" name="L570" href="#L570">570</a>             increment =  (z6Term + z4Term + PI_SQUARED * (z4Term - z2Term) * kTerm2 +
-<a class="jxr_linenumber" name="L571" href="#L571">571</a>                     pi4 * (1 - twoZ2) * kTerm2 * kTerm2) * FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
+<a class="jxr_linenumber" name="L513" href="#L513">513</a>         <strong class="jxr_keyword">double</strong> pFrac = Hpower.getEntry(k - 1, k - 1);
+<a class="jxr_linenumber" name="L514" href="#L514">514</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt;= n; ++i) {
+<a class="jxr_linenumber" name="L515" href="#L515">515</a>             pFrac *= (<strong class="jxr_keyword">double</strong>) i / (<strong class="jxr_keyword">double</strong>) n;
+<a class="jxr_linenumber" name="L516" href="#L516">516</a>         }
+<a class="jxr_linenumber" name="L517" href="#L517">517</a> 
+<a class="jxr_linenumber" name="L518" href="#L518">518</a>         <strong class="jxr_keyword">return</strong> pFrac;
+<a class="jxr_linenumber" name="L519" href="#L519">519</a>     }
+<a class="jxr_linenumber" name="L520" href="#L520">520</a> 
+<a class="jxr_linenumber" name="L521" href="#L521">521</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L522" href="#L522">522</a> <em class="jxr_javadoccomment">     * Computes the Pelz-Good approximation for \(P(D_n &lt; d)\) as described in [2] in the class javadoc.</em>
+<a class="jxr_linenumber" name="L523" href="#L523">523</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L524" href="#L524">524</a> <em class="jxr_javadoccomment">     * @param d value of d-statistic (x in [2])</em>
+<a class="jxr_linenumber" name="L525" href="#L525">525</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
+<a class="jxr_linenumber" name="L526" href="#L526">526</a> <em class="jxr_javadoccomment">     * @return \(P(D_n &lt; d)\)</em>
+<a class="jxr_linenumber" name="L527" href="#L527">527</a> <em class="jxr_javadoccomment">     * @since 3.4</em>
+<a class="jxr_linenumber" name="L528" href="#L528">528</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L529" href="#L529">529</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">double</strong> pelzGood(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n) {
+<a class="jxr_linenumber" name="L530" href="#L530">530</a> 
+<a class="jxr_linenumber" name="L531" href="#L531">531</a>         <em class="jxr_comment">// Change the variable since approximation is for the distribution evaluated at d / sqrt(n)</em>
+<a class="jxr_linenumber" name="L532" href="#L532">532</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> sqrtN = FastMath.sqrt(n);
+<a class="jxr_linenumber" name="L533" href="#L533">533</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z = d * sqrtN;
+<a class="jxr_linenumber" name="L534" href="#L534">534</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z2 = d * d * n;
+<a class="jxr_linenumber" name="L535" href="#L535">535</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z4 = z2 * z2;
+<a class="jxr_linenumber" name="L536" href="#L536">536</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z6 = z4 * z2;
+<a class="jxr_linenumber" name="L537" href="#L537">537</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> z8 = z4 * z4;
+<a class="jxr_linenumber" name="L538" href="#L538">538</a> 
+<a class="jxr_linenumber" name="L539" href="#L539">539</a>         <em class="jxr_comment">// Eventual return value</em>
+<a class="jxr_linenumber" name="L540" href="#L540">540</a>         <strong class="jxr_keyword">double</strong> ret = 0;
+<a class="jxr_linenumber" name="L541" href="#L541">541</a> 
+<a class="jxr_linenumber" name="L542" href="#L542">542</a>         <em class="jxr_comment">// Compute K_0(z)</em>
+<a class="jxr_linenumber" name="L543" href="#L543">543</a>         <strong class="jxr_keyword">double</strong> sum = 0;
+<a class="jxr_linenumber" name="L544" href="#L544">544</a>         <strong class="jxr_keyword">double</strong> increment = 0;
+<a class="jxr_linenumber" name="L545" href="#L545">545</a>         <strong class="jxr_keyword">double</strong> kTerm = 0;
+<a class="jxr_linenumber" name="L546" href="#L546">546</a>         <strong class="jxr_keyword">double</strong> z2Term = PI_SQUARED / (8 * z2);
+<a class="jxr_linenumber" name="L547" href="#L547">547</a>         <strong class="jxr_keyword">int</strong> k = 1;
+<a class="jxr_linenumber" name="L548" href="#L548">548</a>         <strong class="jxr_keyword">for</strong> (; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
+<a class="jxr_linenumber" name="L549" href="#L549">549</a>             kTerm = 2 * k - 1;
+<a class="jxr_linenumber" name="L550" href="#L550">550</a>             increment = FastMath.exp(-z2Term * kTerm * kTerm);
+<a class="jxr_linenumber" name="L551" href="#L551">551</a>             sum += increment;
+<a class="jxr_linenumber" name="L552" href="#L552">552</a>             <strong class="jxr_keyword">if</strong> (increment &lt;= PG_SUM_RELATIVE_ERROR * sum) {
+<a class="jxr_linenumber" name="L553" href="#L553">553</a>                 <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="L554" href="#L554">554</a>             }
+<a class="jxr_linenumber" name="L555" href="#L555">555</a>         }
+<a class="jxr_linenumber" name="L556" href="#L556">556</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
+<a class="jxr_linenumber" name="L557" href="#L557">557</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
+<a class="jxr_linenumber" name="L558" href="#L558">558</a>         }
+<a class="jxr_linenumber" name="L559" href="#L559">559</a>         ret = sum * FastMath.sqrt(2 * FastMath.PI) / z;
+<a class="jxr_linenumber" name="L560" href="#L560">560</a> 
+<a class="jxr_linenumber" name="L561" href="#L561">561</a>         <em class="jxr_comment">// K_1(z)</em>
+<a class="jxr_linenumber" name="L562" href="#L562">562</a>         <em class="jxr_comment">// Sum is -inf to inf, but k term is always (k + 1/2) ^ 2, so really have</em>
+<a class="jxr_linenumber" name="L563" href="#L563">563</a>         <em class="jxr_comment">// twice the sum from k = 0 to inf (k = -1 is same as 0, -2 same as 1, ...)</em>
+<a class="jxr_linenumber" name="L564" href="#L564">564</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> twoZ2 = 2 * z2;
+<a class="jxr_linenumber" name="L565" href="#L565">565</a>         sum = 0;
+<a class="jxr_linenumber" name="L566" href="#L566">566</a>         kTerm = 0;
+<a class="jxr_linenumber" name="L567" href="#L567">567</a>         <strong class="jxr_keyword">double</strong> kTerm2 = 0;
+<a class="jxr_linenumber" name="L568" href="#L568">568</a>         <strong class="jxr_keyword">for</strong> (k = 0; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
+<a class="jxr_linenumber" name="L569" href="#L569">569</a>             kTerm = k + 0.5;
+<a class="jxr_linenumber" name="L570" href="#L570">570</a>             kTerm2 = kTerm * kTerm;
+<a class="jxr_linenumber" name="L571" href="#L571">571</a>             increment = (PI_SQUARED * kTerm2 - z2) * FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
 <a class="jxr_linenumber" name="L572" href="#L572">572</a>             sum += increment;
 <a class="jxr_linenumber" name="L573" href="#L573">573</a>             <strong class="jxr_keyword">if</strong> (FastMath.abs(increment) &lt; PG_SUM_RELATIVE_ERROR * FastMath.abs(sum)) {
 <a class="jxr_linenumber" name="L574" href="#L574">574</a>                 <strong class="jxr_keyword">break</strong>;
@@ -585,425 +585,456 @@
 <a class="jxr_linenumber" name="L577" href="#L577">577</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
 <a class="jxr_linenumber" name="L578" href="#L578">578</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
 <a class="jxr_linenumber" name="L579" href="#L579">579</a>         }
-<a class="jxr_linenumber" name="L580" href="#L580">580</a>         <strong class="jxr_keyword">double</strong> sum2 = 0;
-<a class="jxr_linenumber" name="L581" href="#L581">581</a>         kTerm2 = 0;
-<a class="jxr_linenumber" name="L582" href="#L582">582</a>         <strong class="jxr_keyword">for</strong> (k = 1; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
-<a class="jxr_linenumber" name="L583" href="#L583">583</a>             kTerm2 = k * k;
-<a class="jxr_linenumber" name="L584" href="#L584">584</a>             increment = PI_SQUARED * kTerm2 * FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
-<a class="jxr_linenumber" name="L585" href="#L585">585</a>             sum2 += increment;
-<a class="jxr_linenumber" name="L586" href="#L586">586</a>             <strong class="jxr_keyword">if</strong> (FastMath.abs(increment) &lt; PG_SUM_RELATIVE_ERROR * FastMath.abs(sum2)) {
-<a class="jxr_linenumber" name="L587" href="#L587">587</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L588" href="#L588">588</a>             }
-<a class="jxr_linenumber" name="L589" href="#L589">589</a>         }
-<a class="jxr_linenumber" name="L590" href="#L590">590</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
-<a class="jxr_linenumber" name="L591" href="#L591">591</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
-<a class="jxr_linenumber" name="L592" href="#L592">592</a>         }
-<a class="jxr_linenumber" name="L593" href="#L593">593</a>         <em class="jxr_comment">// Again, adjust coefficients instead of doubling sum, sum2</em>
-<a class="jxr_linenumber" name="L594" href="#L594">594</a>         ret += (sqrtHalfPi / n) * (sum / (36 * z2 * z2 * z2 * z) - sum2 / (18 * z2 * z));
-<a class="jxr_linenumber" name="L595" href="#L595">595</a> 
-<a class="jxr_linenumber" name="L596" href="#L596">596</a>         <em class="jxr_comment">// K_3(z) One more time with feeling - two doubly infinite sums, all k powers even.</em>
-<a class="jxr_linenumber" name="L597" href="#L597">597</a>         <em class="jxr_comment">// Multiply coefficient denominators by 2, so omit doubling sums.</em>
-<a class="jxr_linenumber" name="L598" href="#L598">598</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> pi6 = pi4 * PI_SQUARED;
-<a class="jxr_linenumber" name="L599" href="#L599">599</a>         sum = 0;
-<a class="jxr_linenumber" name="L600" href="#L600">600</a>         <strong class="jxr_keyword">double</strong> kTerm4 = 0;
-<a class="jxr_linenumber" name="L601" href="#L601">601</a>         <strong class="jxr_keyword">double</strong> kTerm6 = 0;
-<a class="jxr_linenumber" name="L602" href="#L602">602</a>         <strong class="jxr_keyword">for</strong> (k = 0; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
-<a class="jxr_linenumber" name="L603" href="#L603">603</a>             kTerm = k + 0.5;
-<a class="jxr_linenumber" name="L604" href="#L604">604</a>             kTerm2 = kTerm * kTerm;
-<a class="jxr_linenumber" name="L605" href="#L605">605</a>             kTerm4 = kTerm2 * kTerm2;
-<a class="jxr_linenumber" name="L606" href="#L606">606</a>             kTerm6 = kTerm4 * kTerm2;
-<a class="jxr_linenumber" name="L607" href="#L607">607</a>             increment = (pi6 * kTerm6 * (5 - 30 * z2) + pi4 * kTerm4 * (-60 * z2 + 212 * z4) +
-<a class="jxr_linenumber" name="L608" href="#L608">608</a>                     PI_SQUARED * kTerm2 * (135 * z4 - 96 * z6) - 30 * z6 - 90 * z8) *
-<a class="jxr_linenumber" name="L609" href="#L609">609</a>                     FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
-<a class="jxr_linenumber" name="L610" href="#L610">610</a>             sum += increment;
-<a class="jxr_linenumber" name="L611" href="#L611">611</a>             <strong class="jxr_keyword">if</strong> (FastMath.abs(increment) &lt; PG_SUM_RELATIVE_ERROR * FastMath.abs(sum)) {
-<a class="jxr_linenumber" name="L612" href="#L612">612</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L613" href="#L613">613</a>             }
-<a class="jxr_linenumber" name="L614" href="#L614">614</a>         }
-<a class="jxr_linenumber" name="L615" href="#L615">615</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
-<a class="jxr_linenumber" name="L616" href="#L616">616</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
-<a class="jxr_linenumber" name="L617" href="#L617">617</a>         }
-<a class="jxr_linenumber" name="L618" href="#L618">618</a>         sum2 = 0;
-<a class="jxr_linenumber" name="L619" href="#L619">619</a>         <strong class="jxr_keyword">for</strong> (k = 1; k &lt; MAXIMUM_PARTIAL_SUM_COUNT; k++) {
-<a class="jxr_linenumber" name="L620" href="#L620">620</a>             kTerm2 = k * k;
-<a class="jxr_linenumber" name="L621" href="#L621">621</a>             kTerm4 = kTerm2 * kTerm2;
-<a class="jxr_linenumber" name="L622" href="#L622">622</a>             increment = (-pi4 * kTerm4 + 3 * PI_SQUARED * kTerm2 * z2) *
-<a class="jxr_linenumber" name="L623" href="#L623">623</a>                     FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
-<a class="jxr_linenumber" name="L624" href="#L624">624</a>             sum2 += increment;
-<a class="jxr_linenumber" name="L625" href="#L625">625</a>             <strong class="jxr_keyword">if</strong> (FastMath.abs(increment) &lt; PG_SUM_RELATIVE_ERROR * FastMath.abs(sum2)) {
-<a class="jxr_linenumber" name="L626" href="#L626">626</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L627" href="#L627">627</a>             }
-<a class="jxr_linenumber" name="L628" href="#L628">628</a>         }
-<a class="jxr_linenumber" name="L629" href="#L629">629</a>         <strong class="jxr_keyword">if</strong> (k == MAXIMUM_PARTIAL_SUM_COUNT) {
-<a class="jxr_linenumber" name="L630" href="#L630">630</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/TooManyIterationsException.html">TooManyIterationsException</a>(MAXIMUM_PARTIAL_SUM_COUNT);
-<a class="jxr_linenumber" name="L631" href="#L631">631</a>         }
-<a class="jxr_linenumber" name="L632" href="#L632">632</a>         <strong class="jxr_keyword">return</strong> ret + (sqrtHalfPi / (sqrtN * n)) * (sum / (3240 * z6 * z4) +
-<a class="jxr_linenumber" name="L633" href="#L633">633</a>                 + sum2 / (108 * z6));
-<a class="jxr_linenumber" name="L634" href="#L634">634</a> 
-<a class="jxr_linenumber" name="L635" href="#L635">635</a>     }
-<a class="jxr_linenumber" name="L636" href="#L636">636</a> 
-<a class="jxr_linenumber" name="L637" href="#L637">637</a>     <em class="jxr_javadoccomment">/***</em>
-<a class="jxr_linenumber" name="L638" href="#L638">638</a> <em class="jxr_javadoccomment">     * Creates {@code H} of size {@code m x m} as described in [1] (see above).</em>
-<a class="jxr_linenumber" name="L639" href="#L639">639</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L640" href="#L640">640</a> <em class="jxr_javadoccomment">     * @param d statistic</em>
-<a class="jxr_linenumber" name="L641" href="#L641">641</a> <em class="jxr_javadoccomment">     * @param n sample size</em>
-<a class="jxr_linenumber" name="L642" href="#L642">642</a> <em class="jxr_javadoccomment">     * @return H matrix</em>
-<a class="jxr_linenumber" name="L643" href="#L643">643</a> <em class="jxr_javadoccomment">     * @throws NumberIsTooLargeException if fractional part is greater than 1</em>
-<a class="jxr_linenumber" name="L644" href="#L644">644</a> <em class="jxr_javadoccomment">     * @throws FractionConversionException if algorithm fails to convert {@code h} to a</em>
-<a class="jxr_linenumber" name="L645" href="#L645">645</a> <em class="jxr_javadoccomment">     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k</em>
-<a class="jxr_linenumber" name="L646" href="#L646">646</a> <em class="jxr_javadoccomment">     *         - h) / m\) for integer {@code k, m} and \(0 &lt;= h &lt; 1\).</em>
-<a class="jxr_linenumber" name="L647" href="#L647">647</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L648" href="#L648">648</a>     <strong class="jxr_keyword">private</strong> FieldMatrix&lt;BigFraction&gt; createExactH(<strong class="jxr_keyword">double</strong> d, <strong class="jxr_keyword">int</strong> n)
-<a class="jxr_linenumber" name="L649" href="#L649">649</a>         <strong class="jxr_keyword">throws</strong> NumberIsTooLargeException, <a href="../../../../../../org/apache/commons/math3/fraction/FractionConversionException.html">FractionConversionException</a> {
-<a class="jxr_linenumber" name="L650" href="#L650">650</a> 
-<a class="jxr_linenumber" name="L651" href="#L651">651</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> k = (<strong class="jxr_keyword">int</strong>) Math.ceil(n * d);
-<a class="jxr_linenumber" name="L652" href="#L652">652</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> m = 2 * k - 1;
-<a class="jxr_linenumber" name="L653" href="#L653">653</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> hDouble = k - n * d;
-<a class="jxr_linenumber" name="L654" href="#L654">654</a>         <strong class="jxr_keyword">if</strong> (hDouble &gt;= 1) {
-<a class="jxr_linenumber" name="L655" href="#L655">655</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html">NumberIsTooLargeException</a>(hDouble, 1.0, false);
-<a class="jxr_linenumber" name="L656" href="#L656">656</a>         }
-<a class="jxr_linenumber" name="L657" href="#L657">657</a>         <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a> h = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="L658" href="#L658">658</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L659" href="#L659">659</a>             h = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a>(hDouble, 1.0e-20, 10000);
-<a class="jxr_linenumber" name="L660" href="#L660">660</a>         } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> FractionConversionException e1) {
-<a class="jxr_linenumber" name="L661" href="#L661">661</a>             <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L662" href="#L662">662</a>                 h = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a>(hDouble, 1.0e-10, 10000);
-<a class="jxr_linenumber" name="L663" href="#L663">663</a>             } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> FractionConversionException e2) {
-<a class="jxr_linenumber" name="L664" href="#L664">664</a>                 h = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a>(hDouble, 1.0e-5, 10000);
-<a class="jxr_linenumber" name="L665" href="#L665">665</a>             }
-<a class="jxr_linenumber" name="L666" href="#L666">666</a>         }

[... 778 lines stripped ...]


Mime
View raw message