1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)d_mod.c 5.5 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 #ifdef tahoe 13 #include <tahoe/math/FP.h> 14 #endif 15 16 double d_mod(x,y) 17 double *x, *y; 18 { 19 double floor(), quotient = *x / *y; 20 if (quotient >= 0.0) 21 quotient = floor(quotient); 22 else { 23 #ifndef tahoe 24 quotient = -floor(-quotient); 25 #else tahoe 26 *(unsigned long *)"ient ^= SIGN_BIT; 27 quotient = floor(quotient); 28 if (quotient !=0) 29 *(unsigned long *)"ient ^= SIGN_BIT; 30 #endif tahoe 31 } 32 return(*x - (*y) * quotient ); 33 } 34