Fixed-Size Floating-Point Types in C and C
While the stdint.h, boost/cstdint.hpp, and cstdint headers provide convenient definitions for fixed-size integer types (e.g., int32_t), there is no comparable standardization for fixed-size floating-point types.
Limited Support in Compilers
Although the C and C languages do not explicitly define fixed-size floating-point types, some compilers offer platform-specific guarantees. For instance, many non-embedded platforms use the IEEE-754 32-bit binary format for their float data type.
Future Standardization Efforts
The C language working group is currently considering the addition of C language bindings for the 2008 revision of IEEE-754. If this proposal is adopted, it may include recommendations for a typedef defining a fixed-size floating-point type. If such a definition is standardized in C, it is likely that the C standard will eventually follow suit.
Current Limitations
In the absence of standardized definitions, the availability and behavior of fixed-size floating-point types vary across compilers and platforms. As a result, relying on platform-specific guarantees is not advisable for cross-platform portability.
The above is the detailed content of Are There Standardized Fixed-Size Floating-Point Types in C and C ?. For more information, please follow other related articles on the PHP Chinese website!