如何使用 Clang 在 Mac OS X 中从 Float 128(大小 16)指定 Float 80(大小 10)?

How do I specify Float 80 (size 10) from Float 128 (size 16) in Mac OS X with Clang?

我正在开发一个库,该库尝试以跨平台的方式实现扩展的 C 标准,为此目的使用各种默认编译器。在 Mac OS X.

上处理扩展精度 vs. 四倍精度时我遇到了障碍

GCC 系列编译器有宏 __float80__float128 可以很好地为我处理这个问题,但是默认的 Mac OS X clang 编译器似乎没有等价物。

版本信息:

Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.3.0
Thread model: posix

此外,一些测试让我了解到 long double1.0L 在 Mac 上都默认为 Float 128(大小 16)。我知道 Float 80 是 x86 定义的,Swift 似乎支持 Float 80 扩展精度,所以必须有一种方法可以在 Mac 上处理它们。不过,我已经搜索了很多,但找不到方法。感谢任何帮助或链接。

下面显示的程序在 macOS 10.14.6 上打印这个 Apple Clang 11.0.0:

The long double format:
    has 64 base-2 digits in its significand, and
    has normal exponents from -16382 (inclusive) to 16384 (exclusive).

这表明它正在为 long double 使用 Intel 80 位格式。 sizeof 显示它是 16 字节的事实仅仅表明 80 位(十字节)被保存在 16 字节的容器中以便于对齐等等。

#include <float.h>
#include <stdio.h>


int main(void)
{
    printf("The long double format:\n");
    printf("\thas %d base-%d digits in its significand, and\n",
        LDBL_MANT_DIG, FLT_RADIX);
    printf("\thas normal exponents from %d (inclusive) to %d (exclusive).\n",
        LDBL_MIN_EXP-1, LDBL_MAX_EXP);
}