UNPKG

double-double

Version:

Pure double-double precision functions *with strict error bounds*.

20 lines (14 loc) 391 B
/** * Returns the number of leading zeros before the decimal point. * * @param str * * @internal */ function getNumLeadingZerosBeforePoint(str: string) { if (str.startsWith('0.')) { return 0; } if (Number(str) === 0) { return 0; } const idx = str.indexOf('.'); return idx === -1 ? str.length : idx; } export { getNumLeadingZerosBeforePoint }