xref: /csrg-svn/usr.bin/f77/libF77/d_mod.c (revision 10463)
1*10463Sdlw /*
2*10463Sdlw  *	"@(#)d_mod.c	1.1"
3*10463Sdlw  */
4*10463Sdlw 
5*10463Sdlw double d_mod(x,y)
6*10463Sdlw double *x, *y;
7*10463Sdlw {
8*10463Sdlw double floor(), quotient = *x / *y;
9*10463Sdlw if (quotient >= 0.0)
10*10463Sdlw 	quotient = floor(quotient);
11*10463Sdlw else
12*10463Sdlw 	quotient = -floor(-quotient);
13*10463Sdlw return(*x - (*y) * quotient );
14*10463Sdlw }
15