Home >Backend Development >C++ >Can You Work With Decimal Data Types in C ?

Can You Work With Decimal Data Types in C ?

Susan Sarandon
Susan SarandonOriginal
2024-11-02 08:53:29522browse

Can You Work With Decimal Data Types in C  ?

Support for Decimal Data Types in C

Question:

Is it possible to utilize decimal data types like decimal32, decimal64, or decimal128 within C programs?

Answer:

The Decimal TR includes classes that are not universally implemented across compilers. Certain compilers, such as gcc, adhere to the C Decimal TR and extend it to C .

Historically, an open-source implementation of the C Decimal TR existed, but it is currently unavailable. If your compiler does not natively support decimal data types, you may consider creating a wrapper for IBM's decNumber library.

To address this issue in future versions of C , an initiative is underway to update the Decimal TR. The goal is to refine the TR into a complete proposal for the upcoming C committee meeting (in Bristol in April). The objective is to have it incorporated into the C standard, potentially in the 2014 revision.

It is important to note that the current implementation is part of a closed-source project. Therefore, the decision to open-source it is beyond the author's control, although there is optimism for its potential release in the future.

The above is the detailed content of Can You Work With Decimal Data Types in C ?. 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