我有以下代码...
ran_int = rand(); //check READ ME Citation B
if (input == 32){
//rand() with 2^31 as lower limit and 2^32 as its upper
long long int upper_limit = 4294967295;
long long int lower_limit = 2147483649
ran_32_64 = (rand() * 2) % (upper_limit - lower_limit);
ran_32_64 += lower_limit;
}
else if(input == 64){
//rand() x 4 with 2^63 as lower limit and 2^64 as its upper
unsigned long long int upper_limit = powl(2, 64);
long long int lower_limit = powl(2, 63);
ran_32_64 = (rand() * 4) % (upper_limit - lower_limit);
ran_32_64 += lower_limit;
}
else if(input == 128){
//rand() x 8 with 2^127 as lower limit
unsigned _int128 upper_limit =
}
对于最后一个块,我需要表示一个 128 位二进制数。我知道我可以将类型 _int128 用于 128 位值,但这并不完全准确。
所以我想完全准确地说我可以使用双精度类型,但我找不到任何关于 128 位双精度类型的文献。
有任何想法吗?