固定大小的浮点类型 [英] Fixed-size floating point types
问题描述
在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屋!