共用方式為


numeric_limits::epsilon

函式會傳回在指定資料型別可以表示的 1 和最小的值大於 1 之間的差異。

static Type epsilon( ) throw( );

傳回值

在為資料型別可以表示的 1 和最小的值大於 1 之間的差異。

備註

值是型別的 floatFLT_EPSILON。 型別epsilon 的最小正浮點數 N 這類 N + epsilon + 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;
}
  

需求

標題: <。>

命名空間: std

請參閱

參考

strstreambuf 類別