固定大小的浮点类型 [英] Fixed-size floating point types

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

问题描述

在stdint.h(C99),<一个href=\"http://www.boost.org/doc/libs/1_42_0/libs/integer/doc/html/boost_integer/cstdint.html\">boost/cstdint.hpp,和cstdint(C ++ 0x中)头中存在,是除其他外,类型int32_t。

In the stdint.h (C99), boost/cstdint.hpp, and cstdint (C++0x) headers there is, among others, the type int32_t.

是否有类似的固定大小的浮点类型?像float32_t?

Are there similar fixed-size floating point types? Something like float32_t?

推荐答案

像这样的事情在C存在或present C ++标准。事实上,甚至不是一个保证浮动将是一个二进制浮点格式都没有。

Nothing like this exists in the C or C++ standards at present. In fact, there isn't even a guarantee that float will be a binary floating-point format at all.

有些编译器保证浮动键入将成为IEEE-754 32位二进制格式。有些则没有。在现实中,浮动其实是在IEEE-754 键入的非嵌入式平台,尽管一些编译器在更广泛的格式评估前pressions通常的警告也适用。

Some compilers guarantee that the float type will be the IEEE-754 32 bit binary format. Some do not. In reality, float is in fact the IEEE-754 single type on most non-embedded platforms, though the usual caveats about some compilers evaluating expressions in a wider format apply.

有正在讨论加入C语言绑定的2008年修订版IEEE-754,这可能考虑建议加入这样一个typedef的工作组。如果这被添加到C,我希望C ++标准将效仿......最终。

There is a working group discussing adding C language bindings for the 2008 revision of IEEE-754, which could consider recommending that such a typedef be added. If this were added to C, I expect the C++ standard would follow suit... eventually.

这篇关于固定大小的浮点类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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