Line | |
---|
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".
|
---|
4 | *
|
---|
5 | * Author: Hans van Eck
|
---|
6 | */
|
---|
7 | /* $Header: /cvsup/minix/src/lib/math/fmod.c,v 1.1.1.1 2005/04/21 14:56:26 beng Exp $ */
|
---|
8 |
|
---|
9 | #include <math.h>
|
---|
10 | #include <errno.h>
|
---|
11 |
|
---|
12 | double
|
---|
13 | fmod(double x, double y)
|
---|
14 | {
|
---|
15 | long i;
|
---|
16 | double val;
|
---|
17 | double frac;
|
---|
18 |
|
---|
19 | if (y == 0) {
|
---|
20 | errno = EDOM;
|
---|
21 | return 0;
|
---|
22 | }
|
---|
23 | frac = modf( x / y, &val);
|
---|
24 |
|
---|
25 | return frac * y;
|
---|
26 |
|
---|
27 | /*
|
---|
28 | val = x / y;
|
---|
29 | if (val > LONG_MIN && val < LONG_MAX) {
|
---|
30 | i = val;
|
---|
31 | return x - i * y;
|
---|
32 | }
|
---|
33 | */
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.