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