Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/math/fmodl.c')
-rw-r--r--winsup/mingw/mingwex/math/fmodl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/math/fmodl.c b/winsup/mingw/mingwex/math/fmodl.c
new file mode 100644
index 000000000..f1c97f10b
--- /dev/null
+++ b/winsup/mingw/mingwex/math/fmodl.c
@@ -0,0 +1,22 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math.h>
+
+long double
+fmodl (long double x, long double y)
+{
+ long double res;
+
+ asm ("1:\tfprem\n\t"
+ "fstsw %%ax\n\t"
+ "sahf\n\t"
+ "jp 1b\n\t"
+ "fstp %%st(1)"
+ : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
+ return res;
+}