Class MemoryCharConversion_doubleUTF8


  • public final class MemoryCharConversion_doubleUTF8
    extends Object
    • Constructor Detail

      • MemoryCharConversion_doubleUTF8

        public MemoryCharConversion_doubleUTF8()
    • Method Detail

      • put

        public static final long put​(double value,
                                     long address)
        This algorithm is somewhere from 3 times to 25 times (depending on exponent) faster than the infinite spaghetti code used in JDK. It generates discrepancies of +/- 1 at the 16th digit and +/- 8 in the 17th digit compared to the stricter JDK algorithm. As digits 16 and 17 cannot be relied upon anyway due to the technical floating point inaccuracy (e.g. the JDK double parser generates comparable discrepancies), the algorithm is still deemed correct ("enough").

        Otherwise, the behavior of the algorithm is the same as that of the JDK implementation (i.e. decimal point character '.', denormalized representation in range ]1E7; 1E-3], exponent character 'E', etc.

        Note that this method is intended as an implementation detail and a "know-what-you-are-doing" tool that does not perform array bound checks. If array bound checking is desired, use VarString.add(double)explicitly.

        Parameters:
        value - the value to be represented as a character sequence.
        address - the memory address where the character sequence shall start.
        Returns:
        the address pointing to after the last character of the assembled sequence.