Metropoli BBS
VIEWER: floorp.c MODE: TEXT (ASCII)
/* Copyright (C) 1994 by Thomas Glen Smith.  All Rights Reserved. */
/* floorp APL2 V1.0.0 **************************************************
* Returns the next lower integer, e.g. for -3.14, returns -4.00, and   *
* for 3.14, returns 3.00.                                              *
***********************************************************************/
#define INCLUDES 0
#include "includes.h"
void floorp(num,ret)
double *num,*ret;
{
	Floor;
	extern double fuzz;
	double nw,rw;

	nw = *num; /* Input. */
	rw = floor(nw);
	if (rw != nw) /* Is input other than integer? */
		if ((rw + 1e0 - nw) < fuzz)
			rw += 1e0;
	*ret = rw;
}
[ RETURN TO DIRECTORY ]