Login
You're viewing the assemblag.es public feed.
  • Aug 13, 2026, 2:52 PM

    I think how the #CCompilers work with types is rather confusing, especially #FloatingPoints .

    there are so many different floating point types and we get to select from
    - 'float'
    - 'double'
    - 'long double'
    and none of them are garanteed to be the same sizes across all the C compilers and not to mention there are 128bit floating point numbers that you can't even use because there is no type for that.
    at least for integers there are (u)int<s>_t types but even those aren't defined by the compiler.

    💬 1🔄 0⭐ 1

Replies

  • Aug 13, 2026, 2:58 PM

    sorry - needed to say it.
    I am working with my Sauce code stuff and idk, I just got annoyed at the fact that I can't be like "please point a floating point number here that is exactly 32bits in size"

    💬 0🔄 0⭐ 1
  • Aug 13, 2026, 4:11 PM

    @loganer You can sorta blame Intel for that one I think (plus there being a billion competing float standards amongst mainframe/minicomputers in the 70s and 80s). Since IBM PCs (could) have an 8087 which uses 80-bit precision internally (so long double could access that directly, and double and float downcasting when getting values out of the 8087), and then some companies extended IEEE floats to 128-bits in incompatible ways so that's also a long double option; and then IEEE made official 128-bit floats too late and incompatible with many of the other extensions, so another option for long double. Plus all the aforementioned completely-non-IEEE proprietary float formats used by the minicomputers C was originally developed and widely used on.

    Given that C89 specifically locked it down to specifically IEEE 754 floats though, it would've really been nice if they'd at least guaranteed that float and double were the standard 32- and 64-bit floats, even if they did leave long double as a free-for-all.

    (There is ISO/IEC TS 18661 implemented by pretty much all C compilers that adds _Float32, _Float64, and optionally _Float128 that are guaranteed to be the fixed-size IEEE 754 float types at least)

    💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • Aug 14, 2026, 8:35 PM

    @nytpu @loganer
    I'd have been much happier with x86 dumping 80-bit extended FP (which now only has HW support through the legacy 8087 instructions) if they had added the 128-bit format. It would have been perfectly fine if 128-bit was significantly slower than 64-bit, just as on nearly all GPUs 64-bit FP is far slower than 32-bit.

    💬 2🔄 0⭐ 0
  • Aug 14, 2026, 8:44 PM

    @brouhaha
    Hmm, I'm not at my computer to look at the standards, but I swear at least C99 and later mandate IEEE 754? In a roundabout way, where it doesn't actually refer you to it but specifies the exact behavior to the point where it has to be IEEE 754 or very similar (e.g. nonstandard bit widths but using IEEE 754 semantics)? I know there's provisions about subnormals, and the specific representable range for a given exponent+mantissa size. But maybe I'm misremembering, because I do know it at least originally supported the historical variety of float types before Intel strongarmed everyone into modern floats.

    I do sorta wish that either 80-bit floats became a standard because they're a nice middle ground (especially because the mantissa is a clean 64-bits). Although yeah, would've been much better to just drop them and support 128-bit floats in hardware instead of letting them stagnate in ancient instructions with no other large float support to be seen

    @loganer

    💬 0🔄 0⭐ 0
  • Aug 15, 2026, 3:25 PM

    @nytpu @loganer
    ISO/IEC 9899:1999 (E)
    §5.2.4.2.2 Characteristics of floating types <float.h>
    ¶ In addition to normalized floating-point numbers ( f 1 > 0 if x ≠ 0), floating types may be able to contain other kinds of floating-point numbers, such as subnormal floating-point numbers (x ≠ 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x ≠ 0, e > emin , f 1 = 0), and values that are not floating-point numbers,
    [goes on to mentioned NaN, infinities]

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0