From f253786a807967c2a7f289fa294b66d5dffadcdd Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sat, 18 Apr 2009 13:58:18 +0000 Subject: Add check for C99 round function to configure, and define a fallback function if round doesn't exist. --- Python/pymath.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Python/pymath.c') diff --git a/Python/pymath.c b/Python/pymath.c index 2e049be870..eb06eb2244 100644 --- a/Python/pymath.c +++ b/Python/pymath.c @@ -69,6 +69,19 @@ copysign(double x, double y) } #endif /* HAVE_COPYSIGN */ +#ifndef HAVE_ROUND +double +round(double x) +{ + double absx, y; + absx = fabs(x); + y = floor(absx); + if (absx - y >= 0.5) + y += 1.0; + return copysign(y, x); +} +#endif /* HAVE_ROUND */ + #ifndef HAVE_LOG1P #include -- cgit v1.2.1