Class RyuDouble


  • public final class RyuDouble
    extends java.lang.Object
    An implementation of Ryu for double.
    • Field Detail

      • DEBUG

        private static boolean DEBUG
      • POW5

        private static final java.math.BigInteger[] POW5
      • POW5_INV

        private static final java.math.BigInteger[] POW5_INV
      • POW5_SPLIT

        private static final int[][] POW5_SPLIT
      • POW5_INV_QUARTER_BITCOUNT

        private static final int POW5_INV_QUARTER_BITCOUNT
        See Also:
        Constant Field Values
      • POW5_INV_SPLIT

        private static final int[][] POW5_INV_SPLIT
    • Constructor Detail

      • RyuDouble

        public RyuDouble()
    • Method Detail

      • doubleToString

        public static java.lang.String doubleToString​(double value)
      • doubleToString

        public static java.lang.String doubleToString​(double value,
                                                      RoundingMode roundingMode)
      • pow5bits

        private static int pow5bits​(int e)
      • decimalLength

        private static int decimalLength​(long v)
      • multipleOfPowerOf5

        private static boolean multipleOfPowerOf5​(long value,
                                                  int q)
      • pow5Factor

        private static int pow5Factor​(long value)
      • mulPow5divPow2

        private static long mulPow5divPow2​(long m,
                                           int i,
                                           int j)
        Compute the high digits of m * 5^p / 10^q = m * 5^(p - q) / 2^q = m * 5^i / 2^j, with q chosen such that m * 5^i / 2^j has sufficiently many decimal digits to represent the original floating point number.
      • mulPow5InvDivPow2

        private static long mulPow5InvDivPow2​(long m,
                                              int i,
                                              int j)
        Compute the high digits of m / 5^i / 2^j such that the result is accurate to at least 9 decimal digits. i and j are already chosen appropriately.