diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-04-18 14:41:37 +0000 |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-04-18 14:41:37 +0000 |
commit | 8e5446f902c58a48796c1f0e25a263b7268afe34 (patch) | |
tree | 1f117ab0286a1a2a6f24ff997ca64b67ac1ae194 /Python/pymath.c | |
parent | 4beb89b9f7a40703136d0ddac7aecd71d59d17bc (diff) | |
download | cpython-git-8e5446f902c58a48796c1f0e25a263b7268afe34.tar.gz |
Backport r71704 (add configure check for C99 round function) to trunk.
Diffstat (limited to 'Python/pymath.c')
-rw-r--r-- | Python/pymath.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/pymath.c b/Python/pymath.c index 2749688944..643805856d 100644 --- a/Python/pymath.c +++ b/Python/pymath.c @@ -47,6 +47,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 <float.h> |