转换双重价值为二进制值 [英] convert double value to binary value
问题描述
我如何转换双重价值为二进制值。
How can i convert double value to binary value.
我有以下125252525235558554452221545332224587265一些像这样的价值,我想将其转换为二进制format..so我保持它在双,然后试图转换为二进制(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中有<一个href=\"http://msdn.microsoft.com/en-us/library/system.bitconverter.doubletoint64bits.aspx\"><$c$c>BitConverter.DoubleToInt64Bits$c$c>它可以让你在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中的<一个href=\"http://java.sun.com/javase/6/docs/api/java/lang/Double.html#doubleToLongBits%28double%29\"><$c$c>Double.doubleToLongBits$c$c>它做同样的事情。
In Java there's Double.doubleToLongBits
which does the same thing.
请注意,如果你有一个值,如125252525235558554452221545332224587265那么你已经有了一个多两倍的信息可以在第一时间准确地储存。
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.
这篇关于转换双重价值为二进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!