test/java/lang/Double/ToHexString.java

Print this page

        

*** 23,37 **** /* * @test * @bug 4826774 4926547 * @summary Tests for {Float, Double}.toHexString methods * @author Joseph D. Darcy */ import java.util.regex.*; ! import sun.misc.DoubleConsts; public class ToHexString { private ToHexString() {} /* --- 23,40 ---- /* * @test * @bug 4826774 4926547 * @summary Tests for {Float, Double}.toHexString methods + * @library /lib/testlibrary + * @build jdk.testlibrary.DoubleUtils + * @run main ToHexString * @author Joseph D. Darcy */ import java.util.regex.*; ! import static jdk.testlibrary.DoubleUtils.*; public class ToHexString { private ToHexString() {} /*
*** 78,91 **** result.append("NaN"); } else { // finite value // Extract exponent int exponent = Integer.parseInt(transString.substring(0,3), 16) - ! DoubleConsts.EXP_BIAS; result.append("0x"); ! if (exponent == DoubleConsts.MIN_EXPONENT - 1) { // zero or subnormal if(signifString.equals("0000000000000")) { result.append("0.0p0"); } else { result.append("0." + signifString.replaceFirst("0+$", "").replaceFirst("^$", "0") + --- 81,94 ---- result.append("NaN"); } else { // finite value // Extract exponent int exponent = Integer.parseInt(transString.substring(0,3), 16) - ! EXP_BIAS; result.append("0x"); ! if (exponent == Double.MIN_EXPONENT - 1) { // zero or subnormal if(signifString.equals("0000000000000")) { result.append("0.0p0"); } else { result.append("0." + signifString.replaceFirst("0+$", "").replaceFirst("^$", "0") +