且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将double值转换为二进制值

更新时间:2023-02-04 09:09:51

,你没有指定一个平台或者你感兴趣的二进制值,但在.NET中有一个 BitConverter.DoubleToInt64Bits ,让您轻松获得IEEE 754位的价值。

Well, you haven't specified a platform or what sort of binary value you're interested in, but in .NET there's BitConverter.DoubleToInt64Bits which lets you get at the IEEE 754 bits making up the value very easily.

在Java中有 Double.doubleToLongBits 做同样的事情。

In Java there's Double.doubleToLongBits which does the same thing.

请注意,如果你有一个值,如125252525235558554452221545332224587265t母鸡你有更多的信息,而不是一个双人可以准确地存储在首位。

Note that if you have a value such as "125252525235558554452221545332224587265" then you've got more information than a double can store accurately in the first place.