返回描述了各种方法实现可以为具有浮点值选择为整数值。
static const float_round_style round_style = round_toward_zero;
返回值
描述使从样式的 float_round_style 枚举的值。
备注
成员存储描述了各种方法实现可以为具有浮点值选择为整数值。
移动样式是硬编码,此实现,因此,即使程序启动工作按不同模式的舍入值,不会更改。
示例
// numeric_limits_round_style.cpp
// compile with: /EHsc
#include <iostream>
#include <float.h>
#include <limits>
using namespace std;
int main( )
{
cout << "The rounding style for a double type is: "
<< numeric_limits<double>::round_style << endl;
_controlfp_s(NULL,_RC_DOWN,_MCW_RC );
cout << "The rounding style for a double type is now: "
<< numeric_limits<double>::round_style << endl;
cout << "The rounding style for an int type is: "
<< numeric_limits<int>::round_style << endl;
}
要求
页眉: <限制>
命名空间: std