xref: /csrg-svn/usr.bin/f77/libF77/d_mod.c (revision 22863)
110463Sdlw /*
2*22863Skre  * Copyright (c) 1980 Regents of the University of California.
3*22863Skre  * All rights reserved.  The Berkeley software License Agreement
4*22863Skre  * specifies the terms and conditions for redistribution.
5*22863Skre  *
6*22863Skre  *	@(#)d_mod.c	5.1	06/07/85
710463Sdlw  */
810463Sdlw 
910463Sdlw double d_mod(x,y)
1010463Sdlw double *x, *y;
1110463Sdlw {
1210463Sdlw double floor(), quotient = *x / *y;
1310463Sdlw if (quotient >= 0.0)
1410463Sdlw 	quotient = floor(quotient);
1510463Sdlw else
1610463Sdlw 	quotient = -floor(-quotient);
1710463Sdlw return(*x - (*y) * quotient );
1810463Sdlw }
19