110532Sdlw /* 222962Skre * Copyright (c) 1980 Regents of the University of California. 322962Skre * All rights reserved. The Berkeley software License Agreement 422962Skre * specifies the terms and conditions for redistribution. 522962Skre * 6*29969Smckusick * @(#)r_mod.c 5.4 11/03/86 710532Sdlw */ 810532Sdlw 9*29969Smckusick #ifndef tahoe 1023856Sjerry float flt_retval; 1123856Sjerry 1223854Sjerry float r_mod(x,y) 1310532Sdlw float *x, *y; 1410532Sdlw { 1510532Sdlw double floor(), quotient = *x / *y; 1610532Sdlw if (quotient >= 0.0) 1710532Sdlw quotient = floor(quotient); 1810532Sdlw else 1910532Sdlw quotient = -floor(-quotient); 2023856Sjerry flt_retval = *x - (*y) * quotient ; 2123856Sjerry return(flt_retval); 2210532Sdlw } 23*29969Smckusick 24*29969Smckusick #else tahoe 25*29969Smckusick 26*29969Smckusick /* THIS IS BASED ON THE TAHOE REPR. FOR FLOATING POINT */ 27*29969Smckusick #include <tahoemath/FP.h> 28*29969Smckusick 29*29969Smckusick double r_mod(x,y) 30*29969Smckusick float *x, *y; 31*29969Smckusick { 32*29969Smckusick double floor(), quotient = *x / *y; 33*29969Smckusick if (quotient >= 0.0) 34*29969Smckusick quotient = floor(quotient); 35*29969Smckusick else { 36*29969Smckusick *(unsigned long *)"ient ^= SIGN_BIT; 37*29969Smckusick quotient = floor(quotient); 38*29969Smckusick if (quotient != 0) 39*29969Smckusick *(unsigned long *)"ient ^= SIGN_BIT; 40*29969Smckusick } 41*29969Smckusick return(*x - (*y) * quotient ); 42*29969Smckusick } 43*29969Smckusick #endif tahoe 44