CKTIS / C
_Decimal64 — decimal floating type
_Decimal64 denotes a C23 decimal floating type. Its availability depends on the implementation.
Version: C23; repository compiler flag, production runtime not attested
Syntax
_Decimal64 identifier = 0.1dd;_Decimal64 is a keyword specifying a decimal floating type. Decimal types are optional in C23; selecting C23 mode alone does not guarantee support.
The suffix dd or DD gives a constant type _Decimal64. Here, 0.1dd + 0.2dd equals 0.3dd exactly. Not all calculations are exact: division and results exceeding precision can require rounding.
Do not directly add _Decimal64 to double: an explicit conversion is needed. The example prints the comparison as int rather than passing a decimal value to %f.
The repository compiler flag does not establish production runtime support; that support is not attested.
Examples
#include <stdio.h>
int main(void)
{
_Decimal64 a = 0.1dd;
_Decimal64 b = 0.2dd;
int equal = (a + b == 0.3dd);
printf("%d\n", equal);
return equal ? 0 : 1;
}
Result
1
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.