1999-12-16 02:25:23 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* rint.c
|
|
|
|
* rint() implementation
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/port/rint.c
|
1999-12-16 02:25:23 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2001-08-24 16:07:50 +02:00
|
|
|
#include "c.h"
|
2010-02-06 06:42:49 +01:00
|
|
|
|
1999-12-16 02:25:23 +01:00
|
|
|
#include <math.h>
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
double
|
|
|
|
rint(double x)
|
1999-12-16 02:25:23 +01:00
|
|
|
{
|
2010-02-06 06:42:49 +01:00
|
|
|
return (x >= 0.0) ? floor(x + 0.5) : ceil(x - 0.5);
|
1999-12-16 02:25:23 +01:00
|
|
|
}
|