function cdf( x, n, p ) {
	if (
		isnan( x ) ||
		isnan( n ) ||
		isnan( p ) ||
		p < 0.0 ||
		p > 1.0 ||
		!isNonNegativeInteger( n ) ||
		n === PINF
	) {
		return NaN;
	}
	if ( x < 0.0 ) {
		return 0.0;
	}
	if ( x >= n ) {
		return 1.0;
	}
	x = floor( x + 1.0e-7 );
	return betainc( p, x + 1.0, n - x, true, true );
}
Evaluates the cumulative distribution function (CDF) for a binomial distribution with number of trials `n` and success probability `p` at a value `x`.

@param {number} x - input value
@param {NonNegativeInteger} n - number of trials
@param {Probability} p - success probability
@returns {Probability} evaluated CDF

@example
var y = cdf( 3.0, 20, 0.2 );
// returns ~0.411

@example
var y = cdf( 21.0, 20, 0.2 );
// returns 1.0

@example
var y = cdf( 5.0, 10, 0.4 );
// returns ~0.834

@example
var y = cdf( 0.0, 10, 0.4 );
// returns ~0.006

@example
var y = cdf( NaN, 20, 0.5 );
// returns NaN

@example
var y = cdf( 0.0, NaN, 0.5 );
// returns NaN

@example
var y = cdf( 0.0, 20, NaN );
// returns NaN

@example
var y = cdf( 2.0, 1.5, 0.5 );
// returns NaN

@example
var y = cdf( 2.0, -2.0, 0.5 );
// returns NaN

@example
var y = cdf( 2.0, 20, -1.0 );
// returns NaN

@example
var y = cdf( 2.0, 20, 1.5 );
// returns NaN