为什么不支持 __float128?

Why is __float128 not supported?

所以我尝试使用 __float128 类型在 C 中进行非常精确的数学运算。

我的代码看起来像这样:

#include <stdio.h>

int main() {
    __float128 num;
}

我尝试在没有任何选项的情况下编译它:

gcc -o test test.c

我得到的错误是:

test.c:4:5: error: __float128 is not supported on this target

我的 gcc 是在 x86 Macbook 上使用 Homebrew 安装的。

My gcc was installed using Homebrew on an x86 Macbook.

你可能已经做到了,但是你 运行 编译测试程序的 gcc 实际上是伪装成 GCC 的 Apple clang,你会看到你是否这样做 gcc -v . Apple clang 不支持 __float128,但真正的 GCC 支持。 /usr/local/bin/gcc-11 -o test test.c使用你安装的真正的GCC,然后应该编译成功。