英文:
How is double hexDouble = 0xf.8p3 calculated as 15.5 * 2^3 ? (f.8 == 15.5 ??)
问题
public class Main
{
public static void main(String[] args) {
double hexDouble = 0xf.8p3;
System.out.println(hexDouble);
}
}
double hexDouble = 0xf.8p3;
被计算为 15.5 * 2^3 吗?(f.8 == 15.5 ??)
f.8,读作 15.8 吗?
请告诉我……
英文:
public class Main
{
public static void main(String[] args) {
double hexDouble = 0xf.8p3;
System.out.println(hexDouble);
}
}
How is double hexDouble = 0xf.8p3 calculated as 15.5 * 2^3 ? (f.8 == 15.5 ??)
Is f.8, read as 15.8 ??
Please tell me .......
答案1
得分: 3
f
是 15 * 16^0 = 15,而 8
是 8 * 16^-1 = 0.5,所以 f.8
(十六进制) 对应 15.5
(十进制)。
英文:
f
is 15 * 16<sup>0</sup> = 15, and 8
is 8 * 16<sup>-1</sup> = 0.5, so f.8
(hex) is 15.5
(decimal).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论