xref: /csrg-svn/usr.bin/f77/libF77/r_mod.c (revision 22962)
110532Sdlw /*
2*22962Skre  * Copyright (c) 1980 Regents of the University of California.
3*22962Skre  * All rights reserved.  The Berkeley software License Agreement
4*22962Skre  * specifies the terms and conditions for redistribution.
5*22962Skre  *
6*22962Skre  *	@(#)r_mod.c	5.1	06/07/85
710532Sdlw  */
810532Sdlw 
910532Sdlw double r_mod(x,y)
1010532Sdlw float *x, *y;
1110532Sdlw {
1210532Sdlw double floor(), quotient = *x / *y;
1310532Sdlw if (quotient >= 0.0)
1410532Sdlw 	quotient = floor(quotient);
1510532Sdlw else
1610532Sdlw 	quotient = -floor(-quotient);
1710532Sdlw return(*x - (*y) * quotient );
1810532Sdlw }
19