Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9a5f34

Browse files
committed
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.
1 parent a28518a commit c9a5f34

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Doc/lib/libmath.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ \section{\module{math} ---
9595

9696
\begin{funcdesc}{rint}{x, y}
9797
Return the integer nearest to \var{x} as a real.
98+
(Only available on platforms where this is in the standard C math library.)
9899
\end{funcdesc}
99100

100101
\begin{funcdesc}{sin}{x}

Modules/mathmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ FUNC2(math_pow, power, math_pow_doc,
156156
FUNC2(math_pow, pow, math_pow_doc,
157157
"pow(x,y)\n\nReturn x**y.")
158158
#endif
159+
#ifdef HAVE_RINT
159160
FUNC1(math_rint, rint, math_rint_doc,
160161
"rint(x)\n\nReturn the integer nearest to x as a real.")
162+
#endif
161163
FUNC1(math_sin, sin, math_sin_doc,
162164
"sin(x)\n\nReturn the sine of x.")
163165
FUNC1(math_sinh, sinh, math_sinh_doc,
@@ -269,7 +271,9 @@ static PyMethodDef math_methods[] = {
269271
{"log10", math_log10, 0, math_log10_doc},
270272
{"modf", math_modf, 0, math_modf_doc},
271273
{"pow", math_pow, 0, math_pow_doc},
274+
#ifdef HAVE_RINT
272275
{"rint", math_rint, 0, math_rint_doc},
276+
#endif
273277
{"sin", math_sin, 0, math_sin_doc},
274278
{"sinh", math_sinh, 0, math_sinh_doc},
275279
{"sqrt", math_sqrt, 0, math_sqrt_doc},

0 commit comments

Comments
 (0)