question: private double testFit ( double [ ] x , double [ ] test , Distribution dist ) throws ArithmeticException { for ( int i = 0 ; i < test . length ; i ++ ) { test [ i ] = dist . cdf ( x [ i ] ) ; if ( test [ i ] > 1. ) { test [ i ] = 1. ; } if ( test [ i ] < 0. ) { test [ i ] = 0. ; } if ( Double . isNaN ( test [ i ] ) ) { throw new ArithmeticException ( "Got NaN after fitting " + dist . toString ( ) ) ; } } Arrays . sort ( test ) ; return KolmogorovSmirnovTest . simpleTest ( test ) ; }
target:  Test the quality of a fit.