Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/fp_exception_mask.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/fp_exception_mask.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/fp_exception_mask.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/fp_exception_mask.html on line 8
Get or set the current exception mask
#include <fpstatus.h>
int fp_exception_mask ( int new_mask,
int set );
- new_mask
- The new mask to apply.
The bits include:
- _FP_EXC_INVALID
- _FP_EXC_DIVZERO
- _FP_EXC_OVERFLOW
- _FP_EXC_UNDERFLOW
- _FP_EXC_INEXACT
- _FP_EXC_DENORMAL
- set
- A value that indicates what you want the function to do:
- If set < 0, return the current mask.
The new_mask argument is ignored.
- If set = 0, disable the bits in the exception mask
that correspond to the bits set in new_mask.
- If set > 0, enable the bits in the exception
mask that correspond to the bits set in new_mask.
libm
Use the -l m option to
qcc
to link against this library.
The fp_exception_mask() function gets or sets
the current exception mask, depending on the value of the set
argument.
- If set < 0
- The current exception mask.
- If set ≥ 0
- The previous mask.
|
This function doesn't return a special value to indicate that an error
occurred.
If you want to check for errors, set
errno
to 0, call the function, and then check errno again. |
#include <fpstatus.h>
int main(int argc, char** argv)
{
int ret;
if ((ret = fp_exception_mask(0, -1)) < 0)
printf("*** Problem retrieving exceptions \n");
printf("Exceptions Enabled: \n\t");
if (ret & _FP_EXC_INEXACT)
printf("Inexact ");
if (ret & _FP_EXC_DIVZERO)
printf("DivZero ");
if (ret & _FP_EXC_UNDERFLOW)
printf("Underflow ");
if (ret & _FP_EXC_OVERFLOW)
printf("Overflow ");
if (ret & _FP_EXC_INVALID)
printf("Invalid ");
printf("\n");
/* Set the exception mask to enable division by zero errors */
if ((ret = fp_exception_mask(_FP_EXC_DIVZERO, 1)) < 0)
printf("*** Problem setting exceptions \n");
if ((ret = fp_exception_mask(0, -1)) < 0)
printf("*** Problem retrieving exceptions \n");
printf("Exceptions Enabled: \n\t");
if (ret & _FP_EXC_INEXACT)
printf("Inexact ");
if (ret & _FP_EXC_DIVZERO)
printf("DivZero ");
if (ret & _FP_EXC_UNDERFLOW)
printf("Underflow ");
if (ret & _FP_EXC_OVERFLOW)
printf("Overflow ");
if (ret & _FP_EXC_INVALID)
printf("Invalid ");
printf("\n");
return(0);
}
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
fp_exception_value(),
fp_precision(),
fp_rounding(),
fp_setenv()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/fp_exception_mask.html on line 227
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/fp_exception_mask.html on line 227