C# 中的 BitConverter.Int64BitsToDouble() 方法
C# 中的 BitConverter.Int64BitsToDouble() 方法用于将指定的 64 位有符号整数重新解释为双精度浮点数。
语法
以下是语法 −
public static double Int64BitsToDouble (long val);
上面,参数 value 是要转换的数字。
示例
现在,我们来看一个实现 BitConverter.Int64BitsToDouble() 方法的示例 −
using System;
public class Demo {
public static void Main(){
long d = 9846587687;
Console.Write("Value (64-bit signed integer) = "+d);
double res = BitConverter.Int64BitsToDouble(d);
Console.Write("
Value (double-precision floating point number) = "+res);
}
}输出
这将产生以下输出 −
Value (64-bit signed integer) = 9846587687 Value (double-precision floating point number) = 4.86486070491012E-314
示例
我们再来看一个示例 −
using System;
public class Demo {
public static void Main(){
long d = 20;
Console.Write("Value (64-bit signed integer) = "+d);
double res = BitConverter.Int64BitsToDouble(d);
Console.Write("
Value (double-precision floating point number) = "+res);
}
}输出
这将产生以下输出 −
Value (64-bit signed integer) = 20 Value (double-precision floating point number) = 9.88131291682493E-323
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP