ftanh static method

double ftanh(
  1. double x
)

Implementation

static double ftanh( double x ){
	if( x > _eps5 ){
		return 2.0 / (1.0 + ClipMath.exp( -2.0 * x )) - 1.0;
	}
	if( x < -_eps5 ){
		return 1.0 - 2.0 / (ClipMath.exp( 2.0 * x ) + 1.0);
	}
	return x * (1.0 - x * x / 3.0);
}