761f56c043e42600c70ce069077e0ec25fb13632
[reactos.git] / lib / sdk / crt / math / i386 / fmodf.c
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 /*
7 * Written by J.T. Conklin <jtc@netbsd.org>.
8 * Public domain.
9 *
10 * Adapted for float type by Danny Smith
11 * <dannysmith@users.sourceforge.net>.
12 */
13
14 #include <math.h>
15
16 float
17 fmodf (float x, float y)
18 {
19 float res = 0.0F;
20
21 asm ("1:\tfprem\n\t"
22 "fstsw %%ax\n\t"
23 "sahf\n\t"
24 "jp 1b\n\t"
25 "fstp %%st(1)"
26 : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
27 return res;
28 }