Continuing from: https://github.com/ziglang/zig/issues/20579
Platform status of long double as IEEE binary64/binary128 vs IBM 128-bit:
- FreeBSD:
long doubleis IEEE binary64 regardless of bitness/endianness ✅ - NetBSD:
long doubleis IEEE binary64 regardless of bitness/endianness ✅ - OpenBSD:
long doubleis IEEE binary64 regardless of bitness/endianness ✅ - Linux w/ musl:
long doubleis IEEE binary64 regardless of bitness/endianness ✅ - Linux w/ glibc: Inspect your bitness and endianness, and consult your local distro maintainers 🤷
So Linux w/ glibc is the main issue here.
For powerpc64le-linux-gnu:
- Fedora: Transition to IEEE binary128 complete: https://developers.redhat.com/articles/2023/05/16/benefits-fedora-38-long-double-transition-ppc64le
- Gentoo: Transition to IEEE binary128 complete: https://wiki.gentoo.org/wiki/Project:Toolchain/23.0_profile_transition#bug_.23882815:_transition_ppc64le_23.0_profiles_to_128-bit_IEEE_long_double_ABI
- Debian: Transition to IEEE binary128 In progress for Forky: https://wiki.debian.org/ToolChain/IEEELongDouble
- Ubuntu: Transition to IEEE binary128 in progress for 26.04: https://bugs.launchpad.net/ubuntu/+bug/2132257
Clearly IBM 128-bit is well on its way out here.
For powerpc64-linux-*, recall that we dropped ELF v1 support (https://github.com/ziglang/zig/pull/25478). This means that, to my knowledge, we only really support Adelie Linux and Chimera Linux because they use musl, which requires ELF v2. This means that their long double is IEEE binary64 because musl requires that. At this time, I'm not aware of any distro that actually supports glibc with ELF v2, which means we don't have to worry about IBM 128-bit here either. Even if such a distro pops up, I'd hope the maintainers would be smart enough to pick IEEE binary128.
For powerpc-linux-*, there seems to be a mix of musl and glibc distros, with the former necessarily using IEEE binary64, and the latter using IBM 128-bit. There's no ongoing effort to migrate to IEEE binary128 for the glibc distros, mainly because barely anybody cares about 32-bit PowerPC anymore. I think it's clearly not worth our time to support the IBM 128-bit format just for powerpc-linux-gnu, an already dying target.
In conclusion, I think we should do the following: long double is IEEE binary64 for FreeBSD, NetBSD, OpenBSD, and Linux w/ musl; IEEE binary128 for all other targets, including Linux w/ glibc and freestanding.