/* * f l o o r . c */ #ifdef DOCUMENTATION title floor largest integer not greater than argument index largest integer not greater than argument usage .s double x, y, floor(); .br y = floor(x); .s description .s Returns the largest integer not greater than the argument. .s diagnostics .s If the argument is less than the integer part of -HUGE a floating point exception (overflow) will occur. .s internal .s author .s Hamish Ross. .s date .s 31-Jan-85 #endif double floor(x) double x; { double y, modf(); return((modf(x, &y) < 0.0) ? y - 1.0 : y); }