Metropoli BBS
VIEWER: mod.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1996 by Thomas Glen Smith.  All Rights Reserved.*/
/* mod APL2 V1.0.0 ******************************************************
* Called by binomp, indexgen, powerp, powerx, and ravel2.               *
* Given two operands of type double, mod returns the remainder from the *
* division of the first operand by the second. e.g. mod(5,2) => 1,      *
* mod(5,-2) => -1, and mod(-5,-2) => -1.                                *
************************************************************************/
#define INCLUDES MATH
#include "includes.h"
double mod(num,den)
double num,den;
{
	double floor();

	return(num - den * floor(num / (den + (den == 0.0))));
}
[ RETURN TO DIRECTORY ]