numeric_limits::round_style
부동 소수점 값을 정수 값으로 반올림 구현을 선택할 수 있는 다양 한 방법에 설명 하는 값을 반환 합니다.
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