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

(fmt) Inconsistency formatting subnormal doubles with hexadecimal conversion

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5
    • 8
    • 6
    • core-libs
    • b103
    • x86
    • linux
    • Verified

    Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      When formatting a subnormal double with hexadecimal conversion "a", it is normalized if the precision is specified and less then 14. However it should never be normalized according to the spec:

      http://java.sun.com/javase/6/docs/api/java/util/Formatter.html:
      'a' '\u0061' Requires the output to be formatted in hexadecimal exponential form.
      If m is a double value with a subnormal representation then the significand is represented by the characters '0x0.' followed by the hexadecimal representation of the rest of the significand as a fraction. The exponent is represented by 'p-1022'

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The results are in comments.

      System.out.printf("%a\n", 0x0.123p-1022 ); // 0x0.123p-1022
      System.out.printf("%1.3a\n", 0x0.123p-1022 ); // 0x1.230p-1026
      System.out.printf("%1.15a\n", 0x0.123p-1022 ); // 0x0.123000000000000p-1022



      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Activity

          People

            bpb Brian Burkhalter
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: