Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 42x 13x 29x 29x 1x 28x 2x 26x | /** * 获取精度 */ export function getPrecision(value: number) { if (typeof value !== "number") { return 0; } const str = value.toString(); if (/e-(.+)$/.test(str)) { return parseInt(RegExp.$1, 10); } if (str.indexOf(".") >= 0) { return str.length - str.indexOf(".") - 1; } return 0; } |