How is double hexDouble = 0xf.8p3 calculated as 15.5 * 2^3 ? (f.8 == 15.5 ??)

huangapple go评论67阅读模式
英文:

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

huangapple
  • 本文由 发表于 2020年9月19日 05:34:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/63963104.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定