Home  >  Article  >  Backend Development  >  How Can I Use Decimal Data Types in C When My Compiler Doesn\'t Support Them?

How Can I Use Decimal Data Types in C When My Compiler Doesn\'t Support Them?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-02 07:59:29481browse

How Can I Use Decimal Data Types in C   When My Compiler Doesn't Support Them?

Using Decimal Data Types in C

In C , decimal data types like decimal32, decimal64, and decimal128 are provided by the Decimal TR (Technical Report). However, the implementation of these types varies across compilers.

Compiler Support

  • Some compilers, such as gcc, implement the Decimal TR and provide the corresponding extensions in C .
  • Other compilers may not support these types.

Options for Using Decimal Data Types

If your compiler does not support decimal types, consider the following options:

  • IBM decNumber Library: Create a wrapper for this library to access decimal functionality.
  • TR Proposal: Engage in the efforts to update and standardize the Decimal TR. An implementation is available, but its public release is uncertain.

Note: The Decimal TR and its implementation are subject to change as the standardization process progresses.

The above is the detailed content of How Can I Use Decimal Data Types in C When My Compiler Doesn\'t Support Them?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn