在C#中将64位带符号整数重新解释为双精度浮点数
要将指定的64位带符号整数重新解释为双精度浮点数,代码如下-
示例
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 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短