mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
Add check for C99 round function to configure, and define
a fallback function if round doesn't exist.
This commit is contained in:
parent
f498113f3f
commit
f253786a80
5 changed files with 24 additions and 3 deletions
|
@ -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 <float.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue