Espaços nominais
Variantes
Acções

std::feraiseexcept

Da cppreference.com
< cpp‎ | numeric‎ | fenv

 
 
Biblioteca numéricos
Funções matemáticas comuns
De ponto flutuante ambiente
Números complexos
Matrizes numéricas
Pseudo-aleatório de geração de números
Tempo de compilação aritmética racional (C++11)
Genéricos operações numéricas
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
 
De ponto flutuante ambiente
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
feraiseexcept
(C++11)
(C++11)(C++11)
Constantes de macros
Original:
Macro constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
 
Definido no cabeçalho <cfenv>
int feraiseexcept( int excepts );
(desde C++11)
Tentativas de levantar todas as exceções de ponto flutuante listados na excepts (um bit a bit OU do flutuando macros de exceção de ponto). Se uma das exceções é FE_OVERFLOW ou FE_UNDERFLOW, esta função pode ainda aumentar FE_INEXACT. A ordem em que as exceções são levantadas é indeterminado, exceto que FE_OVERFLOW e FE_UNDERFLOW são sempre levantadas antes FE_INEXACT.
Original:
Attempts to raise all floating point exceptions listed in excepts (a bitwise OR of the flutuando macros de exceção de ponto). If one of the exceptions is FE_OVERFLOW or FE_UNDERFLOW, this function may additionally raise FE_INEXACT. The order in which the exceptions are raised is unspecified, except that FE_OVERFLOW and FE_UNDERFLOW are always raised before FE_INEXACT.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

excepts -
bitmask listando as bandeiras de exceção para levantar
Original:
bitmask listing the exception flags to raise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

0 se todas as exceções listadas foram levantadas, valor não-zero, caso contrário.
Original:
0 if all listed exceptions were raised, non-zero value otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

#include <iostream>
#include <cfenv>
 
#pragma STDC FENV_ACCESS ON
 
int main()
{
    std::feclearexcept(FE_ALL_EXCEPT);
    int r = std::feraiseexcept(FE_UNDERFLOW | FE_DIVBYZERO);
    std::cout <<  "Raising divbyzero and underflow simultaneously "
              << (r?"fails":"succeeds") << " and results in\n";
    int e = std::fetestexcept(FE_ALL_EXCEPT);
    if (e & FE_DIVBYZERO) {
        std::cout << "division by zero\n";
    }
    if (e & FE_INEXACT) {
        std::cout << "inexact\n";
    }
    if (e & FE_INVALID) {
        std::cout << "invalid\n";
    }
    if (e & FE_UNDERFLOW) {
        std::cout << "underflow\n";
    }
    if (e & FE_OVERFLOW) {
        std::cout << "overflow\n";
    }
}

Saída:

Raising divbyzero and underflow simultaneously succeeds and results in
division by zero
underflow

[editar] Veja também

limpa os especificados bandeiras de ponto flutuante de status
Original:
clears the specified floating-point status flags
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
determina qual dos especificados bandeiras de ponto flutuante de estado são definidas
Original:
determines which of the specified floating-point status flags are set
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]