在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 生女孩红包简短祝福语