返回描述了各种方法实现可以为舍入浮点值选择为整数值。
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;
}
要求
标头: <limits>
命名空间: std