1*47940Sbostic /*- 2*47940Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*47940Sbostic * All rights reserved. 422863Skre * 5*47940Sbostic * %sccs.include.proprietary.c% 610463Sdlw */ 7*47940Sbostic 8*47940Sbostic #ifndef lint 9*47940Sbostic static char sccsid[] = "@(#)d_mod.c 5.5 (Berkeley) 04/12/91"; 10*47940Sbostic #endif /* not lint */ 11*47940Sbostic 1229963Smckusick #ifdef tahoe 1345967Sbostic #include <tahoe/math/FP.h> 1445967Sbostic #endif 1510463Sdlw d_mod(x,y)1610463Sdlwdouble d_mod(x,y) 1710463Sdlw double *x, *y; 1810463Sdlw { 1910463Sdlw double floor(), quotient = *x / *y; 2010463Sdlw if (quotient >= 0.0) 2110463Sdlw quotient = floor(quotient); 2229963Smckusick else { 2329963Smckusick #ifndef tahoe 2410463Sdlw quotient = -floor(-quotient); 2529963Smckusick #else tahoe 2629963Smckusick *(unsigned long *)"ient ^= SIGN_BIT; 2729963Smckusick quotient = floor(quotient); 2829963Smckusick if (quotient !=0) 2929963Smckusick *(unsigned long *)"ient ^= SIGN_BIT; 3031042Ssam #endif tahoe 3129963Smckusick } 3210463Sdlw return(*x - (*y) * quotient ); 3310463Sdlw } 34