diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2020-01-15 18:42:46 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020-03-24 16:31:36 -0400 |
commit | bc87299ce72a52f4debf9fc19d859abe34dbdf43 (patch) | |
tree | 95763fe2cf648fe78c7cf2ce273d86b589050152 /src/math/i386/fmodf.c | |
parent | b173e4262f65800ea488b4494125284779a61547 (diff) | |
download | musl-bc87299ce72a52f4debf9fc19d859abe34dbdf43.tar.gz |
math: move x87-family fmod functions to C with inline asm
Diffstat (limited to 'src/math/i386/fmodf.c')
-rw-r--r-- | src/math/i386/fmodf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/math/i386/fmodf.c b/src/math/i386/fmodf.c new file mode 100644 index 00000000..90b56ab0 --- /dev/null +++ b/src/math/i386/fmodf.c @@ -0,0 +1,10 @@ +#include <math.h> + +float fmodf(float x, float y) +{ + unsigned short fpsr; + // fprem does not introduce excess precision into x + do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); + while (fpsr & 0x400); + return x; +} |