FE_DFL_ENV
      From cppreference.net
     
     
     | 
           
           Definido en el encabezado
            
         
            
             
              <fenv.h>
             
            
           
           | 
         ||
| 
           
           
            
             #define FE_DFL_ENV  /*implementation defined*/
            
           
           
          | 
         (desde C99) | |
La macro constante FE_DFL_ENV se expande a una expresión de tipo const fenv_t * , que apunta a una copia completa del entorno de punto flotante predeterminado, es decir, el entorno tal como se carga al inicio del programa.
       Macros adicionales que comiencen con
       
        FE_
       
       seguido de letras mayúsculas, y tengan el tipo
       
        
         
          const
         
         fenv_t
         
          *
         
        
       
       , pueden ser soportadas por una implementación.
      
Ejemplo
         Ejecutar este código
        
       #include <stdio.h> #include <fenv.h> #pragma STDC FENV_ACCESS ON void show_fe_exceptions(void) { printf("current exceptions raised: "); if(fetestexcept(FE_DIVBYZERO)) printf(" FE_DIVBYZERO"); if(fetestexcept(FE_INEXACT)) printf(" FE_INEXACT"); if(fetestexcept(FE_INVALID)) printf(" FE_INVALID"); if(fetestexcept(FE_OVERFLOW)) printf(" FE_OVERFLOW"); if(fetestexcept(FE_UNDERFLOW)) printf(" FE_UNDERFLOW"); if(fetestexcept(FE_ALL_EXCEPT)==0) printf(" none"); printf("\n"); } void show_fe_rounding_method(void) { printf("current rounding method: "); switch (fegetround()) { case FE_TONEAREST: printf ("FE_TONEAREST"); break; case FE_DOWNWARD: printf ("FE_DOWNWARD"); break; case FE_UPWARD: printf ("FE_UPWARD"); break; case FE_TOWARDZERO: printf ("FE_TOWARDZERO"); break; default: printf ("unknown"); }; printf("\n"); } void show_fe_environment(void) { show_fe_exceptions(); show_fe_rounding_method(); } int main() { printf("On startup:\n"); show_fe_environment(); // Change environment fesetround(FE_DOWNWARD); // change rounding mode feraiseexcept(FE_INVALID); // raise exception printf("\nBefore restoration:\n"); show_fe_environment(); fesetenv(FE_DFL_ENV); // restore printf("\nAfter restoring default environment:\n"); show_fe_environment(); }
Salida:
On startup: current exceptions raised: none current rounding method: FE_TONEAREST Before restoration: current exceptions raised: FE_INVALID current rounding method: FE_DOWNWARD After restoring default environment: current exceptions raised: none current rounding method: FE_TONEAREST
Referencias
- Estándar C11 (ISO/IEC 9899:2011):
 
- 
         
- 7.6/9 Entorno de punto flotante <fenv.h> (p: 208)
 
 
- Estándar C99 (ISO/IEC 9899:1999):
 
- 
          
- 7.6/8 Entorno de punto flotante <fenv.h> (p: 188-189)
 
 
Véase también
| 
           
            
             
              
               (C99)
              
             
            
            
           | 
         
          guarda o restaura el entorno actual de punto flotante
           (función)  | 
        
| 
           
            
             
              
               (C99)
              
             
            
            
           | 
         
          restaura el entorno de punto flotante y genera las excepciones previamente generadas
           (función)  | 
        
| 
           
           
            
             Documentación de C++
            
           
           para
           
            
             FE_DFL_ENV
            
           
           
          | 
        |