Set or get the current precision
#include <fpstatus.h> int fp_precision( int newprecision );
The fp_precision() function sets or gets the current floating-point precision, depending on the value of newprecision.
If newprecision is less than 0, the current precision; otherwise, the previous precision.
#include <fpstatus.h>
int main(int argc, char** argv)
{
int ret;
ret = fp_precision(-1);
printf("Precision: ");
if (ret == _FP_PREC_FLOAT)
printf("Float \n");
else if (ret == _FP_PREC_DOUBLE)
printf("Double \n");
else if (ret == _FP_PREC_EXTENDED)
printf("Extended \n");
else if (ret == _FP_PREC_DOUBLE_EXTENDED)
printf("128 Bit \n");
else if (ret == _FP_PREC_EXTENDED)
printf("Extended \n");
else if (ret == _FP_PREC_DOUBLE_EXTENDED)
printf("128 Bit \n");
else
printf("Error \n");
return(0);
}
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |