【发布时间】:2011-09-18 23:09:40
【问题描述】:
我正在尝试将以下十六进制字符串:“41630D54FFF68872”转换为 9988776.0 (float-64)。
使用单精度 float-32 我会这样做:
int intBits = Long.valueOf("hexFloat32", 16).intValue();
float floatValue = Float.intBitsToFloat(intBits);
但这会抛出:java.lang.NumberFormatException: Infinite or NaN when using the 64-bits hex above.
如何将十六进制转换为使用 64 位 IEEE-754 编码的双精度浮点数?
谢谢
【问题讨论】:
标签: java 64-bit floating-point hex ieee-754