var TWO_PI = Math.PI * 2;
|
// SPI is slightly greater than Math.PI, so values that exceed the -180..180
|
// degree range by a tiny amount don't get wrapped. This prevents points that
|
// have drifted from their original location along the 180th meridian (due to
|
// floating point error) from changing their sign.
|
var SPI = 3.14159265359;
|
var sign = require('./sign');
|
|
module.exports = function(x) {
|
return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
|
};
|