summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2000-09-16 03:54:24 +0000
committerTim Peters <tim.peters@gmail.com>2000-09-16 03:54:24 +0000
commit78fc0b57dfd4bf8d3d3ab82e4ffe98cbd6075dac (patch)
treebbc3e5a62e821b16cdfd0acc94a439b481cb90ed
parent53db8154e604959daa1edc08c6573a43f896e410 (diff)
downloadcpython-git-78fc0b57dfd4bf8d3d3ab82e4ffe98cbd6075dac.tar.gz
Fixed legit gripe from c.l.py that math.fmod docs aren't confusing enough.
FRED, please check my monkey-see-monkey-do Tex fiddling!
-rw-r--r--Doc/lib/libmath.tex4
-rw-r--r--Modules/mathmodule.c3
-rw-r--r--Objects/floatobject.c2
3 files changed, 6 insertions, 3 deletions
diff --git a/Doc/lib/libmath.tex b/Doc/lib/libmath.tex
index 598431bdf7..6edf502629 100644
--- a/Doc/lib/libmath.tex
+++ b/Doc/lib/libmath.tex
@@ -60,7 +60,9 @@ Return the floor of \var{x} as a real.
\end{funcdesc}
\begin{funcdesc}{fmod}{x, y}
-Return \code{\var{x} \%\ \var{y}}.
+Return \code{fmod(\var{x}, \var{y})}, as defined by the platform C library.
+Note that the Python expression \code{\var{x} \%\ \var{y}} may not return
+the same result.
\end{funcdesc}
\begin{funcdesc}{frexp}{x}
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index fcd88ad331..c313f35a22 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -106,7 +106,8 @@ FUNC1(fabs, fabs,
FUNC1(floor, floor,
"floor(x)\n\nReturn the floor of x as a real.")
FUNC2(fmod, fmod,
- "fmod(x,y)\n\nReturn x % y.")
+ "fmod(x,y)\n\nReturn fmod(x, y), according to platform C."
+ " x % y may differ.")
FUNC2(hypot, hypot,
"hypot(x,y)\n\nReturn the Euclidean distance, sqrt(x*x + y*y).")
FUNC1(log, log,
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 946e3d99d3..774996f357 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -399,7 +399,7 @@ float_divmod(PyFloatObject *v, PyFloatObject *w)
PyFPE_START_PROTECT("divmod", return 0)
vx = v->ob_fval;
mod = fmod(vx, wx);
- /* fmod is typically exact, so vx-mod is *mathemtically* an
+ /* fmod is typically exact, so vx-mod is *mathematically* an
exact multiple of wx. But this is fp arithmetic, and fp
vx - mod is an approximation; the result is that div may
not be an exact integral value after the division, although