8 static double rndint(double x
, u16_t cw_bits
, u16_t cw_mask
)
12 /* set FPUCW to the right value */
14 fpu_cw_set((cw
& cw_mask
) | cw_bits
);
16 /* perform the round */
24 double nearbyint(double x
)
26 /* round, disabling floating point precision error */
27 return rndint(x
, FPUCW_EXCEPTION_MASK_PM
, ~0);
30 double remainder(double x
, double y
)
35 xclass
= fpclassify(x
);
36 yclass
= fpclassify(y
);
37 if (xclass
== FP_NAN
|| yclass
== FP_NAN
)
40 if (xclass
== FP_INFINITE
|| yclass
== FP_ZERO
)
46 /* call the assembly implementation */
51 double trunc(double x
)
53 /* round in truncate mode, disabling floating point precision error */
55 FPUCW_EXCEPTION_MASK_PM
| FPUCW_ROUNDING_CONTROL_TRUNC
,
56 ~FPUCW_ROUNDING_CONTROL
);