00001 /*------------------------------------------------------------------------- 00002 * 00003 * rint.c 00004 * rint() implementation 00005 * 00006 * IDENTIFICATION 00007 * src/port/rint.c 00008 * 00009 *------------------------------------------------------------------------- 00010 */ 00011 #include "c.h" 00012 00013 #include <math.h> 00014 00015 double 00016 rint(double x) 00017 { 00018 return (x >= 0.0) ? floor(x + 0.5) : ceil(x - 0.5); 00019 }