csx
Version:
Utility functions for TypeStyle
14 lines (13 loc) • 440 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var math = Math;
exports.round = math.round;
/**
* Rounds a decimal by multiplying it by a factor, rounding it, and then dividing it by that same factor
* @param n number to round
* @param factor to use 100 = scale of 2, 100000 = scale of 5
*/
function roundFloat(n, factor) {
return exports.round(n * factor) / factor;
}
exports.roundFloat = roundFloat;