C#中的BitConverter.DoubleToInt64Bits()方法
C#中的BitConverter.DoubleToInt64Bits()方法用于将指定的双精度浮点数转换为64位带符号整数。
语法
以下是语法-
public static long DoubleToInt64Bits (double val);
上面的Val是要转换的数字。
示例
现在让我们看一个实现BitConverter.DoubleToInt64Bits()方法的示例-
using System;
public class Demo {
public static void Main(){
double d = 5.646587687;
Console.Write("Value = "+d);
long res = BitConverter.DoubleToInt64Bits(d);
Console.Write("\n64-bit signed integer = "+res);
}
}输出结果
这将产生以下输出-
Value = 5.646587687 64-bit signed integer = 4618043510978159912
示例
让我们看另一个例子-
using System;
public class Demo {
public static void Main(){
double d = 0.001;
Console.Write("Value = "+d);
long res = BitConverter.DoubleToInt64Bits(d);
Console.Write("\n64-bit signed integer = "+res);
}
}输出结果
这将产生以下输出-
Value = 0.001 64-bit signed integer = 4562254508917369340
热门推荐
4 简短元宵节祝福语
10 朋友生闺女简短祝福语
11 幽默的新娘祝福语简短
12 紫玫瑰生日祝福语简短
13 会计祝福语毕业英语简短
14 过年送礼祝福语简短精辟
15 祝女儿六一祝福语简短
16 新郎朋友红包祝福语简短
17 保洁阿姨送来祝福语简短
18 感谢教官文案祝福语简短