TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
long double type in C is a standard scalar floating-point data type designed to provide precision and range greater than or equal to that of a standard double. It represents the maximum floating-point precision natively supported by the compiler and the target hardware architecture.
Memory Representation and Precision
The C standard does not mandate a strict bit-width forlong double, only requiring that its precision is at least that of double. Consequently, its memory footprint and IEEE 754 implementation are highly architecture- and compiler-dependent:
- x86/x86_64 (GCC/Clang on Linux/macOS): Typically implemented as an 80-bit extended-precision format. Due to memory alignment requirements,
sizeof(long double)evaluates to 12 or 16 bytes, though only 10 bytes (80 bits) are used for the value. - ARM64/AArch64: Often implemented as a 128-bit quadruple-precision floating-point format (
sizeof(long double) == 16). - MSVC (Windows): Implemented as a 64-bit standard double-precision format. On this compiler,
long doubleis strictly identical todouble(sizeof(long double) == 8).
Syntax and Literals
By default, floating-point literals in C are of typedouble. To explicitly declare a long double literal, you must append the L or l suffix. Omitting the suffix causes the compiler to truncate the literal to double precision before assigning it to the long double variable.
Formatted Input/Output
When interfacing with standard I/O functions (printf, scanf), long double requires the L length modifier combined with a floating-point conversion specifier (f, e, g, a).
Standard Library Integration
The C standard library provides dedicated functions and macros forlong double operations to prevent implicit downcasting to double.
Math Functions (<math.h>)
Functions operating on long double are suffixed with l.
<float.h>)
The <float.h> header defines macros specific to long double (prefixed with LDBL_) that expose the implementation details of the type on the current architecture:
LDBL_MANT_DIG: Number of base-radix digits in the floating-point significand.LDBL_DIG: Number of decimal digits that can be rounded and recovered without change.LDBL_MIN/LDBL_MAX: Minimum normalized positive value and maximum representable finite value.LDBL_EPSILON: The difference between 1.0 and the next representablelong doublevalue.
Master C with Deep Grasping Methodology!Learn More





