Skip to content

Add support for C23 interchange float types (_Float32, _Float64, _Float128, ...) #97335

Open
@tgross35

Description

@tgross35

Newer versions of C allow the following relevant interchange types:

  • _Float16: 16-bit IEEE floating point numbers
  • _Float32: 32-bit IEEE floating point numbers
  • _Float64: 64-bit IEEE floating point numbers
  • _Float64x: Extended 64-bit IEEE floating point numbers (e.g. x86 f80 long double)
  • _Float128: 128-bit IEEE floating point numbers
  • _FloatN _Complex
  • Suffix F16/f16
  • Suffix F32/f32
  • Suffix F64/f64
  • Suffix F64x/f64x
  • Suffix F128/f128

GCC currently supports all of these. Clang currently supports only _Float16, but should add the rest.

Link to the draft: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2601.pdf
Link to demo: https://clang.godbolt.org/z/5xbq9919z

C++ also supports the same suffixes for the std types, https://en.cppreference.com/w/cpp/types/floating-point

It sounds like these can't simply be redefines of float and double, see #50110 (cc @AaronBallman)

Metadata

Metadata

Assignees

No one assigned

    Labels

    c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions