fenv.h

Overview

Related Modules:

MATH

Description:

Declares specific functions for performing operations for floating-point exceptions and rounding modes.

You can use the functions provided in this file to set, clear, and store the current floating-point exception and to obtain and set the current rounding mode.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

fenv_t

Defines the floating-point environment.

Macros

Macro Name and Value

Description

FE_INVALID   1

Indicates an invalid floating-point exception. At least one parameter value is not defined in the function.

FE_DIVBYZERO   2

Indicates a pole error exception. The return value is asymptotically infinite when the divisor is zero or the input is asymptotic to zero.

FE_OVERFLOW   4

Indicates an overflow floating-point exception. The result is too large to be represented in the normal return value.

FE_UNDERFLOW   8

Indicates an underflow floating-point exception. The result is too small to be represented in the normal return value.

FE_INEXACT   16

Indicates an inexact floating-point exception.

FE_ALL_EXCEPT   31

Indicates bitwise OR of all the preceding supported floating-point exceptions.

FE_TONEAREST   0

Indicates rounding towards the nearest integer.

FE_DOWNWARD   0x800000

Indicates rounding towards negative infinity.

FE_UPWARD   0x400000

Indicates rounding towards positive infinity.

FE_TOWARDZERO   0xc00000

Indicates rounding towards zero.

FE_DFL_ENV   ((const fenv_t *) -1)

Defines the default floating-point environment.

Typedefs

Typedef Name

Description

fexcept_t

typedef unsigned long 

Floating-point exception type.

Functions

Function Name

Description

feclearexcept (int excepts)

int 

Clears floating-point exceptions specified by excepts.

fegetexceptflag (fexcept_t flagp, int excepts)

int 

Stores the floating-point exceptions specified by excepts into the flagp variable address.

feraiseexcept (int excepts)

int 

Obtains the floating-point exceptions specified by excepts.

fesetexceptflag (const fexcept_t flagp, int excepts)

int 

Sets the exception status flag by copying the floating-point exceptions stored in the flagp address to the excepts parameter.

fetestexcept (int excepts)

int 

Checks whether the floating-point exceptions specified by excepts have been raised.

fegetround (void)

int 

Obtains the macro corresponding to the current rounding mode.

fesetround (int rounding_mode)

int 

Sets the rounding mode.

fegetenv (fenv_t envp)

int 

Stores the current floating-point environment into the object specified by envp.

feholdexcept (fenv_t envp)

int 

Stores the current floating-point environment into the object specified by envp, with all status flags cleared.

fesetenv (const fenv_t envp)

int 

Sets the current floating-point environment.

feupdateenv (const fenv_t envp)

int 

Updates the current floating-point environment from the object specified by envp.