numeric_limits::epsilon

函式會傳回這個區分1和大於的最小值之間的資料型別是可顯示的大於1。

static Type epsilon( ) throw( );

傳回值

介於1和大於的最小值之間的差異為資料型別是可顯示的大於1。

備註

值是型別的 floatFLT_EPSILON。型別的epsilon 是最小的正浮點 N 這類+ Nepsilon + N 是可顯示的。

範例

// numeric_limits_epsilon.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>

using namespace std;

int main( )
{
   cout << "The difference between 1 and the smallest "
        << "value greater than 1\n for float objects is: " 
        << numeric_limits<float>::epsilon( ) 
        << endl;
   cout << "The difference between 1 and the smallest "
        << "value greater than 1\n for double objects is: " 
        << numeric_limits<double>::epsilon( ) 
        << endl;
   cout << "The difference between 1 and the smallest "
        << "value greater than 1\n for long double objects is: " 
        << numeric_limits<long double>::epsilon( ) 
        << endl;
}
  

需求

標題: <limits>

命名空間: std

請參閱

參考

strstreambuf Class