(x, p)
| 9594 | var prefixExponent; |
| 9595 | |
| 9596 | function formatPrefixAuto(x, p) { |
| 9597 | var d = formatDecimalParts(x, p); |
| 9598 | if (!d) return x + ""; |
| 9599 | var coefficient = d[0], |
| 9600 | exponent = d[1], |
| 9601 | i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, |
| 9602 | n = coefficient.length; |
| 9603 | return i === n ? coefficient |
| 9604 | : i > n ? coefficient + new Array(i - n + 1).join("0") |
| 9605 | : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) |
| 9606 | : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y! |
| 9607 | } |
| 9608 | |
| 9609 | function formatRounded(x, p) { |
| 9610 | var d = formatDecimalParts(x, p); |
nothing calls this directly
no test coverage detected