Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
The standard CAN CSA ISO IEC TR 24732-12 (2016) is the Canadian adoption of ISO/IEC TR 24732:2016, a Technical Report that specifies extensions to the C programming language to support decimal floating-point arithmetic. It defines data types, operations, and library interfaces for decimal floating-point computation, aligning with IEEE 754-2008 (IEEE Standard for Floating-Point Arithmetic). This Technical Report serves as the foundation for portable, high-performance decimal arithmetic in C, targeting financial, commercial, and scientific applications that require exact decimal representation and rounding.
The standard introduces three primary decimal floating-point types:
_Decimal32 – 32-bit decimal floating-point (7-digit precision)_Decimal64 – 64-bit decimal floating-point (16-digit precision)_Decimal128 – 128-bit decimal floating-point (34-digit precision)These types follow the decimal encoding scheme defined in IEEE 754-2008, using a densely packed decimal (DPD) or binary integer decimal (BID) encoding depending on the implementation. The following table summarizes their characteristics:
| Type | Storage Width | Significant Digits | Exponent Bias | Round-Trip Guarantee |
|---|---|---|---|---|
_Decimal32 | 32 bits | 7 | 101 | 6 decimal digits |
_Decimal64 | 64 bits | 16 | 398 | 15 decimal digits |
_Decimal128 | 128 bits | 34 | 6176 | 33 decimal digits |
_Decimal64 as the default choice for most financial applications—it offers a good balance between precision and performance. Decimal floating-point literals are suffixed with df (for _Decimal32), dd (for _Decimal64), and dl (for _Decimal128). Example:
_Decimal64 price = 1234.56dd; _Decimal64 tax = 0.08dd; _Decimal64 total = price + tax;
The Technical Report specifies a set of functions declared in <decimal.h>. These cover arithmetic operations, conversion to/from strings, and formatting according to locale. Core functions include:
dec32add, dec64sub, dec128mul, etc.dec32fromString, dec64toStringdec128SameQuantum, dec64QuantizeImplementing CAN CSA ISO IEC TR 24732-12 (2016) requires a C compiler that recognizes the decimal floating-point types as built-in or via a conforming library. Several production compilers (e.g., GCC, Clang, Oracle Developer Studio) provide partial or full support. The standard does not mandate a specific encoding, leaving compilers free to choose BID or DPD as long as external representation follows the IEEE interchange format.
__STDC_IEC_559__ and __STDC_DECIMAL_FP__ macros. The standard was later largely absorbed into ISO/IEC 9899:2024 (C23), which now defines std::decimal in <stdfloat.h> with syntax using std::decimal32 etc. Conforming implementations define the macro __STDC_DECIMAL_FP__ to the value 201601L (mirroring the TR’s publication year). Additionally, the <float.h> header may provide attributes such as DEC32_MIN, DEC64_MAX, and DEC128_EPSILON.
The CSA adoption as a National Standard of Canada implies that any product or service claiming conformance to this standard must satisfy all normative requirements of ISO/IEC TR 24732:2016.
Key compliance points include:
— Published 2026 —