如何从long
类型中提取字节。我知道它有8个字节,就像long
一样。如何创建与double
具有相同字节的double a = 1.5;
long b = (long)a; // <- this returns 1
// i want to get this: 0 01111111111 1000000000000000000000000000000000000000000000000000
//which is 4609434218613702656 as long (I guess :) )
变量。
centos7-systemd
请问我该如何快速完成?
答案 0 :(得分:2)
你可以这样得到它
\set HISTCONTROL ignorespace
这将是double a = 1.5;
long l = BitConverter.ToInt64(BitConverter.GetBytes(a), 0);
正如@harold建议的那样
4609434218613702656
也是可能的