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.
|