function erfcx( x ) {
	var x2;

	if ( isnan( x ) ) {
		return x;
	}
	if ( x >= 0.0 ) {
		if ( x > 50.0 ) { // continued-fraction expansion is faster
			if ( x > 5.0e7 ) { // 1-term expansion, important to avoid overflow
				return INV_SQRT_PI / x;
			}
			x2 = x * x;

			// 5-term expansion (rely on compiler for CSE), simplified from: INV_SQRT_PI / (x+0.5/(x+1/(x+1.5/(x+2/x))))
			return INV_SQRT_PI * ( ( x2 * (x2+4.5) ) + 2.0 ) / ( x * ( ( x2*(x2+5.0) ) + 3.75 ) ); // eslint-disable-line max-len
		}
		return erfcxY100( 400.0/(4.0+x) );
	}
	if ( x < -26.7 ) {
		return PINF;
	}
	x2 = x * x;
	if ( x < -6.1 ) {
		return 2.0 * exp( x2 );
	}
	return ( 2.0*exp( x2 ) ) - erfcxY100( 400.0/(4.0-x) );
}
Evaluates the scaled complementary error function.

```tex
\operatorname{erfcx}(x) = \exp{x^2} \cdot \operatorname{erfc}(x)
```

## Notes

-   Use this function to replace expressions containing `exp{x^2} erfc(x)` in order to avoid errors due to underflow or overflow.
-   For expressions of the form `\exp{-x^2} erfcx(x)`, use the complementary error function `erfc(x)` instead, as this substitution maintains accuracy by avoiding roundoff errors for large values of `x`.

@param {number} x - input value
@returns {number} evaluated scaled complementary error function

@example
var y = erfcx( 0.0 );
// returns 1.0

@example
var y = erfcx( 1.0 );
// returns ~0.4276

@example
var y = erfcx( -1.0 );
// returns ~5.01

@example
var y = erfcx( 50.0 );
// returns ~0.011

@example
var y = erfcx( -50.0 );
// returns +Infinity

@example
var y = erfcx( NaN );
// returns NaN