dec21140A ethernet driver for virtualpc, contributed by nicolas tittley.
[minix.git] / lib / i386 / math / fegetround.c
blobf9225ad413a847ba421a9a77b6c608ec87d31b02
1 #include <assert.h>
2 #include <fenv.h>
4 #include "fpu_cw.h"
6 int fegetround(void)
8 u16_t cw;
10 /* read and categorize FPUCW */
11 cw = fpu_cw_get();
12 switch (cw & FPUCW_ROUNDING_CONTROL)
14 case FPUCW_ROUNDING_CONTROL_NEAREST: return FE_TONEAREST;
15 case FPUCW_ROUNDING_CONTROL_DOWN: return FE_DOWNWARD;
16 case FPUCW_ROUNDING_CONTROL_UP: return FE_UPWARD;
17 case FPUCW_ROUNDING_CONTROL_TRUNC: return FE_TOWARDZERO;
20 /* each case has been handled, otherwise the constants are wrong */
21 assert(0);
22 return -1;