MCPcopy Create free account
hub / github.com/questdb/questdb / decimalLength17

Method decimalLength17

core/src/main/java/io/questdb/std/RyuDouble.java:614–632  ·  view source on GitHub ↗

Returns the number of decimal digits in a value known to fit in 17 digits.

(long v)

Source from the content-addressed store, hash-verified

612 * Returns the number of decimal digits in a value known to fit in 17 digits.
613 */
614 static int decimalLength17(long v) {
615 if (v >= 10_000_000_000_000_000L) return 17;
616 if (v >= 1_000_000_000_000_000L) return 16;
617 if (v >= 100_000_000_000_000L) return 15;
618 if (v >= 10_000_000_000_000L) return 14;
619 if (v >= 1_000_000_000_000L) return 13;
620 if (v >= 100_000_000_000L) return 12;
621 if (v >= 10_000_000_000L) return 11;
622 if (v >= 1_000_000_000L) return 10;
623 if (v >= 100_000_000L) return 9;
624 if (v >= 10_000_000L) return 8;
625 if (v >= 1_000_000L) return 7;
626 if (v >= 100_000L) return 6;
627 if (v >= 10_000L) return 5;
628 if (v >= 1_000L) return 4;
629 if (v >= 100L) return 3;
630 if (v >= 10L) return 2;
631 return 1;
632 }
633}

Callers 2

appendMethod · 0.95
doubleToDecimalMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected