C ++十进制数据类型 [英] C++ decimal data types

查看:219
本文介绍了C ++十进制数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有使用十进制数据类型的方法,例如 decimal32 decimal64 /www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2849.pdf\">十进制TR 未针对所有编译器实施。某些编译器(例如 gcc )会实施 C Decimal TR ,并在C ++中提供相应的扩展。在过去有一个开源实现C ++ Decimal TR可用,但我没有找到它。如果您的编译器不支持decimal类型,则最佳选项可能是为IBM的 decNumber库创建一个包装器。 / p>

为了改善未来C ++的情况,我创建了一个计划更新TR ,我将把当前的TR转换成一个完整的提案准备下一个C ++委员会会议(在4月在布里斯托尔),试图让它被采纳到C ++标准,可能进入计划在2014年的修订。实施我是我的正常工作的一部分,它不是由我决定是否可以公开提供,虽然有一些希望它可以在某一时间开源。


Is there a way to use decimal data types such as decimal32, decimal64 or decimal128in my C++ programs?

解决方案

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.

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 ++十进制数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆