C++ decimal data types(C++ 十进制数据类型)
问题描述
有没有办法在我的 C++ 程序中使用十进制数据类型,例如 decimal32
、decimal64
或 decimal128
?
Is there a way to use decimal data types such as decimal32
, decimal64
or decimal128
in my C++ programs?
推荐答案
十进制 TR 并非对所有编译器都实现.一些编译器,例如 gcc,实现了 C Decimal TR 并提供相应的 C++ 扩展.过去有一个可用的 C++ Decimal TR 的开源实现,但我找不到它.如果您的编译器不支持十进制类型,您最好的选择可能是为 IBM 的 decNumber 库创建一个包装器.
The classes from the Decimal TR are not implemented for all compilers. Some compilers, e.g., gcc, implement the C Decimal TR and provide the corresponding extensions in C++, too. In the past there was an open source implementation for the C++ Decimal TR available but I failed to locate it. If your compiler doesn't support the decimal types, your best option is probably to create a wrapper for IBM's decNumber library.
为了改善 C++ 未来的情况,我创建了一个 计划更新 TR 并且我将把当前的 TR 变成一个完整的提案,为下一次 C++ 委员会会议(4 月在布里斯托尔)做好准备,试图让它被采纳到C++ 标准,可能会在 2014 年计划进行修订.我的实现是我日常工作的一部分,我不能决定是否可以公开提供,尽管有一些希望它可以开源在某个时候.
To improve the situation in the future of C++, I have created a plan to update the TR and I'm going to turn the current TR into a complete proposal ready for the next C++ committee meeting (in April in Bristol), trying to get it adopted into the C++ standard, possibly into the revision planned for 2014. The implementation I have is part of my regular work and it isn't up to me to decide whether it is can be made available publically although there is some hope that it can be open sourced at some point.
这篇关于C++ 十进制数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C++ 十进制数据类型


基础教程推荐
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 设计字符串本地化的最佳方法 2022-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- C++,'if' 表达式中的变量声明 2021-01-01
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04