64位除法 [英] 64 bit division
本文介绍了64位除法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能给我一个c代码来划分2个64位数字.我的编译器只支持 32/32 除法.
Can anyone send me a c code to divide 2 64bit numbers. My compiler only supports 32/32 division.
谢谢&问候
玛尼
推荐答案
您确定您的编译器不支持 64 位除法吗?如果您的 C 编译器支持 C99,这应该可以工作:
Are you positive your compiler doesn't support 64-bit division? If your C compiler supports C99, this should work:
#include <stdint.h>
#include <stdio.h>
int main(void)
{
int64_t numerator = 123;
int64_t denominator = 10;
int64_t quotient = numerator / denominator
printf("%" PRId64 " / %" PRId64 " = %" PRId64 "
",
numerator, denominator, quotient);
return 0;
}
这篇关于64位除法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文