c - 64位除法

标签 c algorithm 64-bit

任何人都可以给我发送一个 C 代码来除以 2 个 64 位数字。我的编译器只支持32/32除法。

感谢和问候

玛尼

最佳答案

您确定您的编译器不支持 64 位除法吗?如果您的 C 编译器支持 C99,这应该可以工作:

#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 "\n",
           numerator, denominator, quotient);
    return 0;
}

关于c - 64位除法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/366273/

相关文章:

java - Horner 的小数部分递归算法 - Java

algorithm - 计算合成平方根的高效算法

c# - 如何从 x64 构建应用程序?

c - 这个 C 程序有什么问题..?

c - 为什么这些 C 宏不写成函数呢?

algorithm - 寻求反转(反转?镜像?从里到外)DAG 的算法

c++ - x64 CPU 上的原子 16 字节读取

C-结构中的结构

c - 卸载当前的 gcc 版本并安装旧版本

winapi - 为什么 SetupDiCallClassInstaller 函数仅限于 64 位程序?