MCPcopy Index your code
hub / github.com/apache/echarts / getPrecisionSafe

Function getPrecisionSafe

test/lib/testHelper.js:3227–3238  ·  view source on GitHub ↗

* Copied from src/util/number.ts * Get precision with slow but safe method

(val)

Source from the content-addressed store, hash-verified

3225 * Get precision with slow but safe method
3226 */
3227 function getPrecisionSafe(val) {
3228 // toLowerCase for: '3.4E-12'
3229 var str = val.toString().toLowerCase();
3230
3231 // Consider scientific notation: '3.4e-12' '3.4e+12'
3232 var eIndex = str.indexOf('e');
3233 var exp = eIndex > 0 ? +str.slice(eIndex + 1) : 0;
3234 var significandPartLen = eIndex > 0 ? eIndex : str.length;
3235 var dotIndex = str.indexOf('.');
3236 var decimalPartLen = dotIndex < 0 ? 0 : significandPartLen - 1 - dotIndex;
3237 return Math.max(0, decimalPartLen - exp);
3238 }
3239
3240 /**
3241 * Copied from src/util/number.ts

Callers 1

getPrecisionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…