CKTIS / C
The long double type
long double is a C real floating type. It includes the values of double but need not provide greater precision.
Version: C23; repository compiler flag, production runtime not attested
Syntax
long double name = 1.0L;long double is a distinct real floating type. Its set of values includes that of double, but both types may have the same representation. Do not assume a particular bit width or exact decimal arithmetic.
The L suffix gives a constant type long double: 1.0L. Without a suffix, 1.0 has type double; assigning it later cannot recover lost precision.
In printf, use %Lf; in scanf, use %Lf with a long double * argument. The <float.h> macros LDBL_DIG, LDBL_MAX, and LDBL_MIN describe implementation properties; the last denotes the smallest positive normalized value.
Examples
#include <stdio.h>
int main(void)
{
long double value = 3.0L;
printf("%.1Lf\n", value);
return 0;
}
Result
3.0
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.