numeric_limits::epsilon

函数返回介于1和大于最小值之间的差异为数据类型是可以可用的大于1。

static Type epsilon( ) throw( );

返回值

在1和大于最小值之间的差异为数据类型是可以可用的大于1。

备注

该值为类型的 浮动FLT_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;
}
  

要求

标头: <limits>

命名空间: std

请参见

参考

strstreambuf Class