Kaydet (Commit) 7c418ed8 authored tarafından Fred Drake's avatar Fred Drake

Added descriptions for log() and log10().

Clarified that floor() and ceil() return reals.  Same for the integer part
returned by modf().

Some markup consistency changes.
üst bceaf35a
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
\bimodindex{math} \bimodindex{math}
\renewcommand{\indexsubitem}{(in module math)} \renewcommand{\indexsubitem}{(in module math)}
This module is always available. This module is always available.
It provides access to the mathematical functions defined by the C It provides access to the mathematical functions defined by the \C{}
standard. standard.
They are: They are:
...@@ -25,7 +25,7 @@ Return \code{atan(\var{x} / \var{y})}. ...@@ -25,7 +25,7 @@ Return \code{atan(\var{x} / \var{y})}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ceil}{x} \begin{funcdesc}{ceil}{x}
Return the ceiling of \var{x}. Return the ceiling of \var{x} as a real.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{cos}{x} \begin{funcdesc}{cos}{x}
...@@ -45,7 +45,7 @@ Return the absolute value of the real \var{x}. ...@@ -45,7 +45,7 @@ Return the absolute value of the real \var{x}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{floor}{x} \begin{funcdesc}{floor}{x}
Return the floor of \var{x}. Return the floor of \var{x} as a real.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fmod}{x, y} \begin{funcdesc}{fmod}{x, y}
...@@ -65,9 +65,17 @@ Return the Euclidean distance, \code{sqrt(\var{x}*\var{x} + \var{y}*\var{y})}. ...@@ -65,9 +65,17 @@ Return the Euclidean distance, \code{sqrt(\var{x}*\var{x} + \var{y}*\var{y})}.
Return \code{\var{x} * (2**\var{i})}. Return \code{\var{x} * (2**\var{i})}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{log}{x}
Return the natural logarithm of \var{x}.
\end{funcdesc}
\begin{funcdesc}{log10}{x}
Return the base-10 logarithm of \var{x}.
\end{funcdesc}
\begin{funcdesc}{modf}{x} \begin{funcdesc}{modf}{x}
Return the fractional and integer parts of \var{x}. Both results Return the fractional and integer parts of \var{x}. Both results
carry the sign of \var{x}. carry the sign of \var{x}. The integer part is returned as a real.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pow}{x, y} \begin{funcdesc}{pow}{x, y}
...@@ -94,10 +102,11 @@ Return the tangent of \var{x}. ...@@ -94,10 +102,11 @@ Return the tangent of \var{x}.
Return the hyperbolic tangent of \var{x}. Return the hyperbolic tangent of \var{x}.
\end{funcdesc} \end{funcdesc}
Note that \code{frexp} and \code{modf} have a different call/return Note that \function{frexp()} and \function{modf()} have a different
pattern than their C equivalents: they take a single argument and call/return pattern than their \C{} equivalents: they take a single
return a pair of values, rather than returning their second return argument and return a pair of values, rather than returning their
value through an `output parameter' (there is no such thing in Python). second return value through an `output parameter' (there is no such
thing in Python).
The module also defines two mathematical constants: The module also defines two mathematical constants:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
\bimodindex{math} \bimodindex{math}
\renewcommand{\indexsubitem}{(in module math)} \renewcommand{\indexsubitem}{(in module math)}
This module is always available. This module is always available.
It provides access to the mathematical functions defined by the C It provides access to the mathematical functions defined by the \C{}
standard. standard.
They are: They are:
...@@ -25,7 +25,7 @@ Return \code{atan(\var{x} / \var{y})}. ...@@ -25,7 +25,7 @@ Return \code{atan(\var{x} / \var{y})}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ceil}{x} \begin{funcdesc}{ceil}{x}
Return the ceiling of \var{x}. Return the ceiling of \var{x} as a real.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{cos}{x} \begin{funcdesc}{cos}{x}
...@@ -45,7 +45,7 @@ Return the absolute value of the real \var{x}. ...@@ -45,7 +45,7 @@ Return the absolute value of the real \var{x}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{floor}{x} \begin{funcdesc}{floor}{x}
Return the floor of \var{x}. Return the floor of \var{x} as a real.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fmod}{x, y} \begin{funcdesc}{fmod}{x, y}
...@@ -65,9 +65,17 @@ Return the Euclidean distance, \code{sqrt(\var{x}*\var{x} + \var{y}*\var{y})}. ...@@ -65,9 +65,17 @@ Return the Euclidean distance, \code{sqrt(\var{x}*\var{x} + \var{y}*\var{y})}.
Return \code{\var{x} * (2**\var{i})}. Return \code{\var{x} * (2**\var{i})}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{log}{x}
Return the natural logarithm of \var{x}.
\end{funcdesc}
\begin{funcdesc}{log10}{x}
Return the base-10 logarithm of \var{x}.
\end{funcdesc}
\begin{funcdesc}{modf}{x} \begin{funcdesc}{modf}{x}
Return the fractional and integer parts of \var{x}. Both results Return the fractional and integer parts of \var{x}. Both results
carry the sign of \var{x}. carry the sign of \var{x}. The integer part is returned as a real.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pow}{x, y} \begin{funcdesc}{pow}{x, y}
...@@ -94,10 +102,11 @@ Return the tangent of \var{x}. ...@@ -94,10 +102,11 @@ Return the tangent of \var{x}.
Return the hyperbolic tangent of \var{x}. Return the hyperbolic tangent of \var{x}.
\end{funcdesc} \end{funcdesc}
Note that \code{frexp} and \code{modf} have a different call/return Note that \function{frexp()} and \function{modf()} have a different
pattern than their C equivalents: they take a single argument and call/return pattern than their \C{} equivalents: they take a single
return a pair of values, rather than returning their second return argument and return a pair of values, rather than returning their
value through an `output parameter' (there is no such thing in Python). second return value through an `output parameter' (there is no such
thing in Python).
The module also defines two mathematical constants: The module also defines two mathematical constants:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment