Skip to content

Support for PowerPC's "double-double" format for long double #20579

Closed

Description

@alexrp

Per #10639, f80 was added partially for C long double compatibility and partially to aid the development of Aro.

We need to consider whether Zig should also have language support for the "double-double" format seen on PowerPC systems for long double. Much like f80, this is a legacy format that only really sees use for compatibility reasons. There has been an effort to migrate PowerPC systems to use IEEE binary128 for long double, but to date, this seems to have only manifested on powerpc64le (being a relatively recent target where breaking the world wasn't a huge concern) and for musl (musl requires that long double is IEEE binary64 on all PowerPC targets). In other words, I believe that any big-endian PowerPC system that isn't using musl is still using the "double-double" format.

The Zig type name for this obviously can't be f128 as that's already an IEEE type. f128_ppc? f64_64? f128p (for "paired")?

Note that I'm not aware of a complete and correct soft float implementation for this format that is liberally licensed. There is a soft float implementation for it in libgcc, but I have no idea how complete or correct it is, and again, there's the license issue to consider. Also, LLVM's APFloat is known to produce wrong results for this format in quite a few ways, despite nominally supporting it.

It's interesting to note that GCC just categorically refuses to constant-fold long double values when targeting PowerPC systems with the "double-double" format, to the point of violating the C/C++ standards. Clang, on the other hand, will happily do it but sometimes get wrong results due to the incomplete APFloat support.

cc @Vexu because I imagine this would also affect Aro on PowerPC in the same way that f80 did.

Activity

  1. added
    proposal
    arch-powerpc64
    on Jul 15, 2024
  2. added this to the 0.15.0 milestone on Jul 15, 2024
  3. alexrp commented on Jul 15, 2024

    @alexrp
    MemberAuthor

    Correction to what I wrote: Apparently only Fedora has made the transition to binary128 long double by default on powerpc64le. Debian/Ubuntu seem to still be using the old format. So, it's unfortunately not quite as "legacy" as one might have hoped.

  4. added
    arch-powerpc
    on Oct 29, 2025
  5. modified the milestones: urgent, 0.16.0 on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-powerpcarch-powerpc64proposal

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions