Compartilhar via


numeric_limits::is_exact

Testa se os cálculos feitos em um tipo estão livres de erros de arredondamento.

static const bool is_exact = false;

Valor de retorno

true se os cálculos estão livres de erros de arredondamento; false caso contrário.

Comentários

Todos os tipos predefinidos de inteiro têm representações exatas e seus valores e falsede retorno. Uma representação de ponto fixo ou racional também é considerada precisa, mas uma representação de ponto flutuante não é.

Exemplo

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

using namespace std;

int main( )
{
   cout << "Whether float objects have calculations "
        << "free of rounding errors: "
        << numeric_limits<float>::is_exact
        << endl;
   cout << "Whether double objects have calculations "
        << "free of rounding errors: "
        << numeric_limits<double>::is_exact
        << endl;
   cout << "Whether long int objects have calculations "
        << "free of rounding errors: "
        << numeric_limits<long int>::is_exact
        << endl;
   cout << "Whether unsigned char objects have calculations "
        << "free of rounding errors: "
        << numeric_limits<unsigned char>::is_exact
        << endl;
}
  

Requisitos

limites <deCabeçalho: >

Namespace: std

Consulte também

Referência

Classe strstreambuf