function fallingFactorial( x, n ) {
	var result;
	var xp1;
	var n2;
	var t1;
	var t2;

	if ( isnan( x ) || !isNonNegativeInteger( n ) ) {
		return NaN;
	}
	if ( x === 0.0 ) {
		return 0.0;
	}
	if ( x < 0.0 ) {
		// For `x < 0`, we really have a rising factorial modulo a possible change of sign:
		return ( ( n&1 ) ? -1.0 : 1.0 ) * risingFactorial( -x, n );
	}
	if ( n === 0 ) {
		return 1.0;
	}
	if ( x < 0.5 ) {
		// Computing `1 + x` will throw away digits, so split up calculation...
		if ( n > FLOAT64_MAX_NTH_FACTORIAL-2 ) {
			// Given a ratio of two very large numbers, we need to split the calculation up into two blocks:
			t1 = x * fallingFactorial( x-1.0, FLOAT64_MAX_NTH_FACTORIAL-2 );
			t2 = fallingFactorial( x-FLOAT64_MAX_NTH_FACTORIAL+1.0, n-FLOAT64_MAX_NTH_FACTORIAL+1 ); // eslint-disable-line max-len
			if ( FLOAT64_MAX/abs(t1) < abs(t2) ) {
				return PINF;
			}
			return t1 * t2;
		}
		return x * fallingFactorial( x-1.0, n-1.0 );
	}
	if ( x <= n-1.0 ) {
		// `x+1-n` will be negative and computing the ratio of two gammas will not work, so split the product up into three parts:
		xp1 = x + 1.0;
		n2 = abs( floor( xp1 ) );
		if ( n2 === xp1 ) {
			return 0.0;
		}
		result = gammaDeltaRatio( xp1, -n2 );
		x -= n2;
		result *= x;
		n2 += 1.0;
		if ( n2 < n ) {
			result *= fallingFactorial( x-1.0, n-n2 );
		}
		return result;
	}
	// Simple case: just the ratio of two (positive argument) gamma functions. Note that we don't optimize this for small `n`, because `gammaDeltaRatio` is already optimized for that use case:
	return gammaDeltaRatio( x+1.0, -n );
}
Computes the falling factorial of `x` and `n`.

## Notes

-   The falling factorial is defined as

    ```tex
    \operatorname{fallingFactorial}(x, n) = x (x-1) (x-2) (x-3) \ldots (x-n+1)
    ```

@param {number} x - first function parameter
@param {NonNegativeInteger} n - second function parameter
@returns {number} function value

@example
var v = fallingFactorial( 0.9, 5 );
// returns ~0.644

@example
var v = fallingFactorial( -9.0, 3 );
// returns -990.0

@example
var v = fallingFactorial( 0.0, 2 );
// returns 0.0

@example
var v = fallingFactorial( 3.0, -2 );
// returns NaN