MCPcopy
hub / github.com/apache/echarts / round

Function round

test/lib/testHelper.js:3243–3252  ·  view source on GitHub ↗

* Copied from src/util/number.ts

(x, precision, returnStr)

Source from the content-addressed store, hash-verified

3241 * Copied from src/util/number.ts
3242 */
3243 function round(x, precision, returnStr) {
3244 if (precision == null) {
3245 precision = 10;
3246 }
3247 // Avoid range error
3248 precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX);
3249 // PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01'
3250 x = (+x).toFixed(precision);
3251 return (returnStr ? x : +x);
3252 }
3253 // Although chrome already enlarge this number to 100 for `toFixed`, but
3254 // we sill follow the spec for compatibility.
3255 var ROUND_SUPPORTED_PRECISION_MAX = 20;

Callers 1

createRangeInputDeltaBtnFunction · 0.70

Calls 1

toFixedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…