MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / round$1

Function round$1

libs/echarts/echarts-en.simple.js:18950–18958  ·  view source on GitHub ↗

* (1) Fix rounding error of float numbers. * (2) Support return string to avoid scientific notation like '3.5e-7'. * * @param {number} x * @param {number} [precision] * @param {boolean} [returnStr] * @return {number|string}

(x, precision, returnStr)

Source from the content-addressed store, hash-verified

18948 * @return {number|string}
18949 */
18950function round$1(x, precision, returnStr) {
18951 if (precision == null) {
18952 precision = 10;
18953 }
18954 // Avoid range error
18955 precision = Math.min(Math.max(0, precision), 20);
18956 x = (+x).toFixed(precision);
18957 return returnStr ? x : +x;
18958}
18959
18960/**
18961 * asc sort arr.

Callers 3

createPolarClipPathFunction · 0.70
littleThanFunction · 0.70

Calls 2

minMethod · 0.80
maxMethod · 0.80

Tested by

no test coverage detected