FE_DFL_ENV
De cppreference.com
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Definido en el archivo de encabezado <cfenv>
|
||
#define FE_DFL_ENV /*implementation defined*/ |
(desde C++11) | |
El FE_DFL_ENV constante macro se expande a una expresión de const std::fenv_t* tipo, lo que apunta a una copia completa del defecto de punto flotante de medio ambiente, es decir, el medio ambiente, cargado al inicio del programa .
Original:
The macro constant FE_DFL_ENV expands to an expression of type const std::fenv_t*, which points to a full copy of the default floating-point environment, that is, the environment as loaded at program startup.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Macros adicionales que comienzan con
FE_
seguida por letras mayúsculas, y tienen la const std::fenv_t* tipo, puede ser apoyado por una implementación .Original:
Additional macros that begin with
FE_
followed by uppercase letters, and have the type const std::fenv_t*, may be supported by an implementation.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Ejemplo
Ejecuta este código
#include <iostream> #include <cfenv> #pragma STDC FENV_ACCESS ON void show_env() { int e = std::fetestexcept(FE_ALL_EXCEPT); if(e & FE_DIVBYZERO) std::cout << "division by zero is raised\n"; if(e & FE_INEXACT) std::cout << "inexact is raised\n"; if(e & FE_INVALID) std::cout << "invalid is raised\n"; if(e & FE_UNDERFLOW) std::cout << "underflow is raised\n"; if(e & FE_OVERFLOW) std::cout << "overflow is raised\n"; int r = std::fegetround(); switch(r) { case FE_DOWNWARD: std::cout << "rounding down\n"; break; case FE_TONEAREST: std::cout << "rounding to nearest\n"; break; case FE_TOWARDZERO: std::cout << "rounding to zero\n"; break; case FE_UPWARD: std::cout << "rounding up\n"; break; } } int main() { std::cout << "On startup: \n"; show_env(); std::feraiseexcept(FE_UNDERFLOW | FE_OVERFLOW); std::fesetround(FE_UPWARD); std::cout << "\nBefore restoration: \n"; show_env(); std::fesetenv(FE_DFL_ENV); std::cout << "\nAfter reset to default: \n"; show_env(); }
Salida:
On startup: rounding to nearest Before restoration: underflow is raised overflow is raised rounding up After reset to default: rounding to nearest
[editar] Ver también
(C++11) |
guarda o restaura el entorno actual de punto flotante Original: saves or restores the current floating point environment The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función) |
(C++11) |
restaura el entorno de coma flotante y plantea la anteriormente lanzar excepciones Original: restores the floating-point environment and raises the previously raise exceptions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función) |