c# – 如何从二进制数据中读取64位IEEE标准754双精度数字?
作者:互联网
我有一个由64位IEEE标准754浮点数组成的数据流.在使用C#时,我如何阅读这些双打?有没有办法将long / ulong转换为double?
解决方法:
BitConverter.Int64BitsToDouble
method是专门为此而设计的.或者,您可以在流的顶部使用BinaryReader,并使用其ReadDouble方法直接获取double值.
double doubleValue = BitConverter.Int64BitsToDouble(longValue);
标签:c,floating-point,ieee-754 来源: https://codeday.me/bug/20190627/1300972.html