summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-05-11 18:42:27 (GMT)
committerGuido van Rossum <guido@python.org>2000-05-11 18:42:27 (GMT)
commitc9a5f343bcd33a5cc4405ae298142a3d5fc73d6e (patch)
tree7e31f4337a733238e3d38cf358f84a7f5c6e7c94
parenta28518a6a645710b5c8a78e3d98da4bac828d63e (diff)
downloadcpython-c9a5f343bcd33a5cc4405ae298142a3d5fc73d6e.zip
cpython-c9a5f343bcd33a5cc4405ae298142a3d5fc73d6e.tar.gz
cpython-c9a5f343bcd33a5cc4405ae298142a3d5fc73d6e.tar.bz2
The addition of rint() (by Peter Schneider-Kamp; I forgot to mention
that before) in the previous patch has one problem; rint() is not in the C math library on all platforms (e.g. not for VC++). Make it conditional on HAVE_RINT.
-rw-r--r--Doc/lib/libmath.tex1
-rw-r--r--Modules/mathmodule.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/Doc/lib/libmath.tex b/Doc/lib/libmath.tex
index f4fd2f2..c20fd7f 100644
--- a/Doc/lib/libmath.tex
+++ b/Doc/lib/libmath.tex
@@ -95,6 +95,7 @@ Return \code{\var{x}**\var{y}}.
\begin{funcdesc}{rint}{x, y}
Return the integer nearest to \var{x} as a real.
+(Only available on platforms where this is in the standard C math library.)
\end{funcdesc}
\begin{funcdesc}{sin}{x}
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index e76a32c..1c6b144 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -156,8 +156,10 @@ FUNC2(math_pow, power, math_pow_doc,
FUNC2(math_pow, pow, math_pow_doc,
"pow(x,y)\n\nReturn x**y.")
#endif
+#ifdef HAVE_RINT
FUNC1(math_rint, rint, math_rint_doc,
"rint(x)\n\nReturn the integer nearest to x as a real.")
+#endif
FUNC1(math_sin, sin, math_sin_doc,
"sin(x)\n\nReturn the sine of x.")
FUNC1(math_sinh, sinh, math_sinh_doc,
@@ -269,7 +271,9 @@ static PyMethodDef math_methods[] = {
{"log10", math_log10, 0, math_log10_doc},
{"modf", math_modf, 0, math_modf_doc},
{"pow", math_pow, 0, math_pow_doc},
+#ifdef HAVE_RINT
{"rint", math_rint, 0, math_rint_doc},
+#endif
{"sin", math_sin, 0, math_sin_doc},
{"sinh", math_sinh, 0, math_sinh_doc},
{"sqrt", math_sqrt, 0, math_sqrt_doc},