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_rounding.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_rounding.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_rounding.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_rounding.html on line 8
Set or get the current rounding
#include <fpstatus.h>
int fp_rounding( int newrounding );
- newrounding
- The new rounding; one of:
- < 0 — return the current setting.
- _FP_ROUND_NEAREST
- _FP_ROUND_ZERO
- _FP_ROUND_POSITIVE
- _FP_ROUND_NEGATIVE
libm
Use the -l m option to
qcc
to link against this library.
The fp_rounding() function sets or gets the current rounding mode,
depending on the value of newrounding.
If newrounding is less than 0, the current rounding mode;
otherwise, the previous mode.
|
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>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char** argv)
{
int ret;
ret = fp_rounding(-1);
printf("Rounding mode: ");
if (ret == _FP_ROUND_NEAREST)
printf("Nearest \n");
else if (ret == _FP_ROUND_POSITIVE)
printf("Positive \n");
else if (ret == _FP_ROUND_NEGATIVE)
printf("Negative \n");
else if (ret == _FP_ROUND_ZERO)
printf("To Zero \n");
else
printf("Error \n");
return EXIT_SUCCESS;
}
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
fp_exception_mask(),
fp_exception_value(),
fp_precision(),
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_rounding.html on line 175
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_rounding.html on line 175