in gflog-core/src/main/java/com/epam/deltix/gflog/core/util/Formatting.java [1540:1578]
public static int formatDecimal64(final boolean sign,
final int exponent,
final @Nonnegative long significand,
final @Nonnull byte[] array,
@Nonnegative int offset) {
// Preconditions:
// assert exponent >= DECIMAL_64_EXPONENT_MIN_VALUE && exponent <= DECIMAL_64_EXPONENT_MAX_VALUE;
// assert significand > 0 && significand <= DECIMAL_64_SIGNIFICAND_MAX_VALUE;
// assert array != null;
// assert offset >= 0;
if (sign) {
offset = formatByte(MINUS, array, offset);
}
if (exponent >= 0) {
offset = formatULong(significand, array, offset);
offset = formatZeros(exponent, array, offset);
} else if (exponent > -DECIMAL_64_SIGNIFICAND_MAX_DIGITS) {
final int fractionLength = -exponent;
final long multiplier = multiplierOfULong(fractionLength);
final long integer = significand / multiplier;
final long fraction = significand - integer * multiplier;
offset = formatULong(integer, array, offset);
if (fraction > 0) {
offset = formatByte(DOT, array, offset);
offset = formatFraction(fraction, fractionLength, array, offset);
}
} else {
offset = formatZeroWithDot(array, offset);
offset = formatZeros(-exponent - DECIMAL_64_SIGNIFICAND_MAX_DIGITS, array, offset);
offset = formatFraction(significand, DECIMAL_64_SIGNIFICAND_MAX_DIGITS, array, offset);
}
return offset;
}