110463Sdlw /* 222863Skre * Copyright (c) 1980 Regents of the University of California. 322863Skre * All rights reserved. The Berkeley software License Agreement 422863Skre * specifies the terms and conditions for redistribution. 522863Skre * 6*29963Smckusick * @(#)d_mod.c 5.2 11/03/86 710463Sdlw */ 8*29963Smckusick #ifdef tahoe 9*29963Smckusick #include <tahoemath/FP.h> 10*29963Smckusick #endif tahoe 1110463Sdlw 1210463Sdlw double d_mod(x,y) 1310463Sdlw double *x, *y; 1410463Sdlw { 1510463Sdlw double floor(), quotient = *x / *y; 1610463Sdlw if (quotient >= 0.0) 1710463Sdlw quotient = floor(quotient); 18*29963Smckusick else { 19*29963Smckusick #ifndef tahoe 2010463Sdlw quotient = -floor(-quotient); 21*29963Smckusick #else tahoe 22*29963Smckusick *(unsigned long *)"ient ^= SIGN_BIT; 23*29963Smckusick quotient = floor(quotient); 24*29963Smckusick if (quotient !=0) 25*29963Smckusick *(unsigned long *)"ient ^= SIGN_BIT; 26*29963Smckusick } 27*29963Smckusick #endif tahoe 2810463Sdlw return(*x - (*y) * quotient ); 2910463Sdlw } 30