All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.globalize.src.util.number.round.min.js Maven / Gradle / Ivy

The newest version!
define(["./truncate"],function(numberTruncate){return function(method){method=method||"round";method=method==="truncate"?numberTruncate:Math[method];return function(value,incrementOrExp){var exp,increment;value=+value;if(isNaN(value)){return NaN}if(typeof incrementOrExp==="object"&&incrementOrExp.exponent){exp=+incrementOrExp.exponent;increment=1;if(exp===0){return method(value)}if(!(typeof exp==="number"&&exp%1===0)){return NaN}}else{increment=+incrementOrExp||1;if(increment===1){return method(value)}if(isNaN(increment)){return NaN}increment=increment.toExponential().split("e");exp=+increment[1];increment=+increment[0]}value=value.toString().split("e");value[0]=+value[0]/increment;value[1]=value[1]?+value[1]-exp:-exp;value=method(+(value[0]+"e"+value[1]));value=value.toString().split("e");value[0]=+value[0]*increment;value[1]=value[1]?+value[1]+exp:exp;return+(value[0]+"e"+value[1])}}});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy