function round10( x ) {
	var sign;
	var half;
	var p1;
	var p2;
	var y1;
	var y2;
	var p;
	if (
		isnan( x ) ||
		isInfinite( x ) ||
		x === 0.0
	) {
		return x;
	}
	if ( x < 0 ) {
		x = -x;
		sign = -1.0;
	} else {
		sign = 1.0;
	}

	// Solve the equation `10^p = x` for `p`:
	p = log10( x );

	// Find the previous and next integer powers:
	p1 = floor( p );
	p2 = ceil( p );

	// Handle tiny:
	if ( p1 === MIN_EXP_SUBNORMAL ) {
		return sign * TINY;
	}

	// Handle huge:
	if ( p1 === MAX_EXP ) {
		return sign * HUGE;
	}

	// Compute previous and next powers of 10:
	y1 = pow( 10.0, p1 );
	y2 = pow( 10.0, p2 );

	// Find the closest power of 10:
	half = ( y2 - y1 ) / 2.0;
	if ( y1 + half > x ) {
		return sign * y1;
	}
	return sign * y2;
}
Rounds a numeric value to the nearest power of `10` on a linear scale.

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

@example
var v = round10( 3.141592653589793 );
// returns 1.0

@example
var v = round10( 13.0 );
// returns 10.0

@example
var v = round10( -0.314 );
// returns -0.1