function trigamma( x ) {
	var result;
	var s;
	var y;
	var z;

	result = 0.0;

	// Check for negative arguments and use reflection:
	if ( x <= 0 ) {
		if ( floor( x ) === x ) {
			return NaN;
		}
		s = sinpi( x );
		z = 1.0 - x;
		return -trigamma( z ) + ( PI_SQUARED / ( s*s ) );
	}
	if ( x < 1.0 ) {
		result = 1.0 / ( x*x );
		x += 1.0;
	}
	if ( x <= 2.0 ) {
		result += ( 2.0+rateval12( x ) ) / ( x*x );
	}
	else if ( x <= 4.0 ) {
		result += ( YOFFSET24+rateval24( x ) ) / ( x*x );
	}
	else if ( x <= 8.0 ) {
		y = 1.0 / x;
		result += ( 1.0+rateval48( y ) ) / x;
	}
	else if ( x <= 16.0 ) {
		y = 1.0 / x;
		result += ( 1.0+rateval816( y ) ) / x;
	}
	else {
		y = 1.0 / x;
		result += ( 1.0+rateval16INF( y ) ) / x;
	}
	return result;
}
Evaluates the trigamma function.

@param {number} x - input value
@returns {number} function value

@example
var v = trigamma( -2.5 );
// returns ~9.539

@example
var v = trigamma( 1.0 );
// returns ~1.645

@example
var v = trigamma( 10.0 );
// returns ~0.105

@example
var v = trigamma( NaN );
// returns NaN

@example
var v = trigamma( -1.0 );
// returns NaN