gpt4 book ai didi

java - Long.toBinaryString 未返回 827.0 的预期二进制字符串

转载 作者:行者123 更新时间:2023-11-29 04:33:00 25 4
gpt4 key购买 nike

我正在使用 double,需要找到 827.0 的二进制版本。

环顾四周的方法是this .

我也是这样的:

double myDouble = 827.0;
Long.toBinaryString(Double.doubleToRawLongBits(myDouble))

然而这是返回:

1000000100010011101100000000000000000000000000000000000000000001000000100010011101100000000000000000000000000000000000 0000000001000000100010011101100000000000000000000000000000000000000000010001001110110000000000000000000000000000000 000000000000100000010001001110110000000000000000000000000000000000000000000100000010001001110110000000000000000000000000000 000000000000000100000010001001110110000000000000000000000000000000000000000000100000010011101100000000000000000000000000 000000000000000000100000010001001110110000000000000000000000000000000000000000001000000100010011101100000000000000000000000 000000000000000000000100000010001001110110000000000000000000000000000000000000000001000000100010011101100000000000000000000 000000000000000000000000100000010001001110110000000000000000000000000000000000000000000000000000

而不是 1100111011

知道我哪里出错了吗?

最佳答案

这应该有效:

double myDouble = 827.0;
System.out.println(Long.toBinaryString((long) myDouble));

关于java - Long.toBinaryString 未返回 827.0 的预期二进制字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43024190/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com