Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6964528

Double.toHexString(double d) String manipulation with + in an append of StringBuilder

    XMLWordPrintable

Details

    • b77
    • x86
    • windows_vista
    • Not verified

    Description

      A DESCRIPTION OF THE REQUEST :
      Just a slight fix for performance when doing Double.toHexString(double d) method :P

      Under the method :
      public static String toHexString(double d) {

      It uses StringBuilder for the output however, at line 306, it's done using + syntax in a StringBuilder.

      JUSTIFICATION :
      Performance enchantment...

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The String buffer should be done in a new StringBuilder.append() instead of using +.
      ACTUAL -
      answer.append("p" + (subnormal ?
      DoubleConsts.MIN_EXPONENT:
      FpUtils.getExponent(d) ));

      ---------- BEGIN SOURCE ----------
      answer.append("p" + (subnormal ?
      DoubleConsts.MIN_EXPONENT:
      FpUtils.getExponent(d) ));
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      answer.append("p");
                      answer.append((subnormal ?
      DoubleConsts.MIN_EXPONENT:
      FpUtils.getExponent(d) );

      Attachments

        Activity

          People

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: