C#中的BitConverter.Int64BitsToDouble()方法
C#中的BitConverter.Int64BitsToDouble()方法用于将指定的64位带符号整数重新解释为双精度浮点数。
语法
以下是语法-
public static double Int64BitsToDouble (long val);
上面的参数值是要转换的数字。
示例
现在让我们看一个实现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("\nValue (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("\nValue (double-precision floating point number) = "+res);
}
}输出结果
这将产生以下输出-
Value (64-bit signed integer) = 20 Value (double-precision floating point number) = 9.88131291682493E-323
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短