|
|
1.1 root 1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)d_mod.c 5.3 5/8/87
7: */
8: #ifdef tahoe
9: #include <tahoemath/FP.h>
10: #endif tahoe
11:
12: double d_mod(x,y)
13: double *x, *y;
14: {
15: double floor(), quotient = *x / *y;
16: if (quotient >= 0.0)
17: quotient = floor(quotient);
18: else {
19: #ifndef tahoe
20: quotient = -floor(-quotient);
21: #else tahoe
22: *(unsigned long *)"ient ^= SIGN_BIT;
23: quotient = floor(quotient);
24: if (quotient !=0)
25: *(unsigned long *)"ient ^= SIGN_BIT;
26: #endif tahoe
27: }
28: return(*x - (*y) * quotient );
29: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.