at_wini also needs a pci_reserve() for the pci compatability device, if
[minix3.git] / lib / math / fmod.c
blob8117b2b6ea6a0987f9b3942517c02b0a4b7a606a
1 /*
2 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 * Author: Hans van Eck
6 */
7 /* $Header$ */
9 #include <math.h>
10 #include <errno.h>
12 double
13 fmod(double x, double y)
15 long i;
16 double val;
17 double frac;
19 if (y == 0) {
20 errno = EDOM;
21 return 0;
23 frac = modf( x / y, &val);
25 return frac * y;
28 val = x / y;
29 if (val > LONG_MIN && val < LONG_MAX) {
30 i = val;
31 return x - i * y;