将double值转换为二进制值 [英] convert double value to binary value
问题描述
我如何将double值转换为二进制值。
How can i convert double value to binary value.
我有一些像下面这样的值125252525235558554452221545332224587265我想把它转换成二进制格式...我保持它在双,然后尝试转换为二进制(1& 0的)..我正在使用C#.net
i have some value like this below 125252525235558554452221545332224587265 i want to convert this to binary format..so i am keeping it in double and then trying to convert to binary (1 & 0's).. i am using C#.net
推荐答案
,你没有指定一个平台或者你感兴趣的二进制值,但在.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.
这篇关于将double值转换为二进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!