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

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