Important: The information in this document is obsolete and should not be used for new development.
fegetround
You can use thefegetround
function to save the current rounding direction.
int fegetround (void);DESCRIPTION
Thefegetround
function returns an integer that specifies which rounding direction is currently being used. The integer it returns will be equal to one of the constants shown in Table 8-1. You can save the returned value in an integer variable to save the current rounding direction.EXAMPLES
int rounddir; double_t x, y, result; rounddir = fegetround(); /* save rounding direction */ result = x + y; if (rounddir == FE_TONEAREST) printf("The result was rounded to the nearest value.\n"); else if (rounddir == FE_UPWARD) printf("The result was rounded upward.\n"); else if (rounddir == FE_DOWNWARD) printf("The result was rounded downward.\n"); else if (rounddir == FE_TOWARDZERO) printf("The result was rounded toward zero.\n");