Skip to content

Clarify the return value range of log(x) #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 25 additions & 31 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
template<class T> T norm(const complex<T>&);

template<class T> complex<T> conj(const complex<T>&);
template <class T> complex<T> proj(const complex<T>&);
template<class T> complex<T> proj(const complex<T>&);
template<class T> complex<T> polar(const T&, const T& = 0);

// \ref{complex.transcendentals}, transcendentals:
Expand All @@ -325,9 +325,9 @@
template<class T> complex<T> log (const complex<T>&);
template<class T> complex<T> log10(const complex<T>&);

template<class T> complex<T> pow(const complex<T>&, const T&);
template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
template<class T> complex<T> pow(const T&, const complex<T>&);
template<class T> complex<T> pow (const complex<T>&, const T&);
template<class T> complex<T> pow (const complex<T>&, const complex<T>&);
template<class T> complex<T> pow (const T&, const complex<T>&);

template<class T> complex<T> sin (const complex<T>&);
template<class T> complex<T> sinh (const complex<T>&);
Expand Down Expand Up @@ -1119,7 +1119,7 @@
\begin{itemdescr}
\pnum
\returns
The complex base e exponential of \tcode{x}.
The complex base-$e$ exponential of \tcode{x}.
\end{itemdescr}

\indexlibrary{\idxcode{log}!\idxcode{complex}}%
Expand All @@ -1130,18 +1130,13 @@
\begin{itemdescr}
\pnum
\notes
the branch cuts are along the negative real axis.
The branch cuts are along the negative real axis.

\pnum
\returns
The complex natural (base e) logarithm of \tcode{x},
in the range of a strip mathematically unbounded along the
real axis and in the interval \crange{-i times pi}{i times pi}
along the imaginary axis.
When \tcode{x} is a negative real
number,
\tcode{imag(log(x))}
is pi.
The complex natural (base-$e$) logarithm of \tcode{x}. For all \tcode{x},
\tcode{imag(log(x))} lies in the interval \crange{$-\pi$}{$\pi$}, and
when \tcode{x} is a negative real number, \tcode{imag(log(x))} is $\pi$.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is merely an editorial and typographic reformulation of the original wording. It is unclear how to reconcole this specification of log with Annex G of C11, which requires the phase the logarithm of a negative real number to depend on the sign of the imaginary part (which can be +/-0).

\end{itemdescr}

\indexlibrary{\idxcode{log10}!\idxcode{complex}}%
Expand All @@ -1152,40 +1147,39 @@
\begin{itemdescr}
\pnum
\notes
the branch cuts are along the negative real axis.
The branch cuts are along the negative real axis.

\pnum
\returns
The complex common (base 10) logarithm of \tcode{x}, defined as
\tcode{log(x)/log(10)}.
The complex common (base-$10$) logarithm of \tcode{x}, defined as
\tcode{log(x) / log(10)}.
\end{itemdescr}

\indexlibrary{\idxcode{pow}!\idxcode{complex}}%
\begin{itemdecl}
template<class T>
complex<T> pow(const complex<T>& x, const complex<T>& y);
template<class T> complex<T> pow (const complex<T>& x, const T& y);
template<class T> complex<T> pow (const T& x, const complex<T>& y);
template<class T> complex<T> pow(const complex<T>& x, const complex<T>& y);
template<class T> complex<T> pow(const complex<T>& x, const T& y);
template<class T> complex<T> pow(const T& x, const complex<T>& y);
\end{itemdecl}

\begin{itemdescr}
\pnum
\notes
the branch cuts are along the negative real axis.
The branch cuts are along the negative real axis.

\pnum
\returns
The complex power of base \tcode{x} raised to the \tcode{y}-th power,
The complex power of base \tcode{x} raised to the \tcode{y}$^\text{th}$ power,
defined as
\tcode{exp(y*log(x))}.
\tcode{exp(y * log(x))}.
The value returned for
\tcode{pow(0,0)}
\tcode{pow(0, 0)}
is implementation-defined.
\end{itemdescr}

\indexlibrary{\idxcode{sin}!\idxcode{complex}}%
\begin{itemdecl}
template<class T> complex<T> sin (const complex<T>& x);
template<class T> complex<T> sin(const complex<T>& x);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -1196,7 +1190,7 @@

\indexlibrary{\idxcode{sinh}!\idxcode{complex}}%
\begin{itemdecl}
template<class T> complex<T> sinh (const complex<T>& x);
template<class T> complex<T> sinh(const complex<T>& x);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -1207,13 +1201,13 @@

\indexlibrary{\idxcode{sqrt}!\idxcode{complex}}%
\begin{itemdecl}
template<class T> complex<T> sqrt (const complex<T>& x);
template<class T> complex<T> sqrt(const complex<T>& x);
\end{itemdecl}

\begin{itemdescr}
\pnum
\notes
the branch cuts are along the negative real axis.
The branch cuts are along the negative real axis.

\pnum
\returns
Expand All @@ -1225,7 +1219,7 @@

\indexlibrary{\idxcode{tan}!\idxcode{complex}}%
\begin{itemdecl}
template<class T> complex<T> tan (const complex<T>& x);
template<class T> complex<T> tan(const complex<T>& x);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -1236,7 +1230,7 @@

\indexlibrary{\idxcode{tanh}!\idxcode{complex}}%
\begin{itemdecl}
template<class T> complex<T> tanh (const complex<T>& x);
template<class T> complex<T> tanh(const complex<T>& x);
\end{itemdecl}

\begin{itemdescr}
Expand Down