|
|
1.1 root 1: /*
2: * libm/fmod.c
3: * C mathematics library.
4: * fmod()
5: * ANSI 4.5.6.4.
6: * Floating point remainder function.
7: * Implementation-defined behavior:
8: * issues EDOM error and returns 0.0 when y==0.0.
9: */
10:
11: #include <math.h>
12:
13: #if EMU87
14: #include "emumath.h"
15: #endif
16:
17: double
18: fmod(x, y) double x, y;
19: {
20: register int s;
21:
22: if (y == 0.0) {
23: errno = EDOM;
24: return 0.0;
25: }
26: s = (x >= 0);
27: x = fabs(x);
28: y = fabs(y);
29: x -= y * floor(x/y);
30: return (s) ? x : -x;
31: }
32:
33: /* end of libm/fmod.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.