summaryrefslogtreecommitdiff
path: root/src/fenv/fesetround.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fenv/fesetround.c')
-rw-r--r--src/fenv/fesetround.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fenv/fesetround.c b/src/fenv/fesetround.c
new file mode 100644
index 00000000..9bbd4ade
--- /dev/null
+++ b/src/fenv/fesetround.c
@@ -0,0 +1,23 @@
+#include <fenv.h>
+
+/* __fesetround wrapper for arch independent argument check */
+
+int __fesetround(int);
+
+int fesetround(int r)
+{
+ if (r & ~(
+ FE_TONEAREST
+#ifdef FE_DOWNWARD
+ |FE_DOWNWARD
+#endif
+#ifdef FE_UPWARD
+ |FE_UPWARD
+#endif
+#ifdef FE_TOWARDZERO
+ |FE_TOWARDZERO
+#endif
+ ))
+ return -1;
+ return __fesetround(r);
+}