You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
304 B

#include <soft.h>
/*
* floor and ceil-- greatest integer <= arg
* (resp least >=)
*/
double floor(double d)
{
double fract;
if (d<0.0) {
d = -d;
fract = modf(d, &d);
if (fract != 0.0)
d += 1;
d = -d;
} else
modf(d, &d);
return(d);
}
double ceil(double d)
{
return(-floor(-d));
}