12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4826774 4926547
27 * @summary Tests for {Float, Double}.toHexString methods
28 * @author Joseph D. Darcy
29 */
30
31 import java.util.regex.*;
32 import sun.misc.FpUtils;
33 import sun.misc.DoubleConsts;
34
35 public class ToHexString {
36 private ToHexString() {}
37
38 /*
39 * Given a double value, create a hexadecimal floating-point
40 * string via an intermediate long hex string.
41 */
42 static String doubleToHexString(double d) {
43 return hexLongStringtoHexDoubleString(Long.toHexString(Double.doubleToLongBits(d)));
44 }
45
46 /*
47 * Transform the hexadecimal long output into the equivalent
48 * hexadecimal double value.
49 */
50 static String hexLongStringtoHexDoubleString(String transString) {
51 transString = transString.toLowerCase();
52
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4826774 4926547
27 * @summary Tests for {Float, Double}.toHexString methods
28 * @author Joseph D. Darcy
29 */
30
31 import java.util.regex.*;
32 import sun.misc.DoubleConsts;
33
34 public class ToHexString {
35 private ToHexString() {}
36
37 /*
38 * Given a double value, create a hexadecimal floating-point
39 * string via an intermediate long hex string.
40 */
41 static String doubleToHexString(double d) {
42 return hexLongStringtoHexDoubleString(Long.toHexString(Double.doubleToLongBits(d)));
43 }
44
45 /*
46 * Transform the hexadecimal long output into the equivalent
47 * hexadecimal double value.
48 */
49 static String hexLongStringtoHexDoubleString(String transString) {
50 transString = transString.toLowerCase();
51
|