META-INF.resources.bower_components.globalize.src.util.number.round.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
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])}}});