<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
<title>Wording for imaginary numbers</title>
<meta name="author" content="Thorsten Ottosen" />
<meta name="date" content="2005-08-24" />
<style type="text/css">

/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:date: $Date: 2004/01/12 02:49:54 $
:version: $Revision: 1.2 $
:copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
*/

.first {
  margin-top: 0 }

.last {
  margin-bottom: 0 }

a.toc-backref {
  text-decoration: none ;
  color: black }

dd {
  margin-bottom: 0.5em }

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.attention, div.caution, div.danger, div.error, div.hint,
div.important, div.note, div.tip, div.warning, div.admonition {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

div.hint p.admonition-title, div.important p.admonition-title,
div.note p.admonition-title, div.tip p.admonition-title,
div.admonition p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em }

div.footer, div.header {
  font-size: smaller }

div.sidebar {
  margin-left: 1em ;
  border: medium outset ;
  padding: 0em 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr {
  width: 75% }

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font-family: serif ;
  font-size: 100% }

pre.line-block {
  font-family: serif ;
  font-size: 100% }

pre.literal-block, pre.doctest-block {
  margin-left: 2em ;
  margin-right: 2em ;
  background-color: #eeeeee }

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.option-argument {
  font-style: italic }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

table {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.citation {
  border-left: solid thin gray ;
  padding-left: 0.5ex }

table.docinfo {
  margin: 2em 4em }

table.footnote {
  border-left: solid thin black ;
  padding-left: 0.5ex }

td, th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

th.docinfo-name, th.field-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap }

h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
  font-size: 100% }

tt {
  background-color: #eeeeee }

ul.auto-toc {
  list-style-type: none }

pre{
  BORDER-RIGHT: gray 1pt solid;
  PADDING-RIGHT: 2pt;
  BORDER-TOP: gray 1pt solid;
  DISPLAY: block;
  PADDING-LEFT: 2pt;
  PADDING-BOTTOM: 2pt;
  BORDER-LEFT: gray 1pt solid;
  MARGIN-RIGHT: 32pt;
  PADDING-TOP: 2pt;
  BORDER-BOTTOM: gray 1pt solid;
  FONT-FAMILY: "Courier New", Courier, mono;
  background-color: #EEEEEE;
}


.keyword{color: #0000FF;}
.identifier{}
.comment{font-style: italic; color: #008000;}
.special{color: #800040;}
.preprocessor{color: #3F007F;}
.string{font-style: italic; color: #666666;}
.literal{/*font-style: italic;*/ color: #000000;}
.strike { text-decoration: line-through }
.strikett { text-docoration: line-through; font-family: monospace }
.u { text-decoration: underline }
.utt { text-decoration: underline; font-family: monospace; background-color: #eeeeee; font-size: 80% }

</style>
</head>
<body>
<div class="document" id="wording-for-imaginary-numbers">
<h1 class="title">Wording for imaginary numbers</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Thorsten Ottosen</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference" href="mailto:nesotto&#64;cs.aau.dk">nesotto&#64;cs.aau.dk</a></td></tr>
<tr class="field"><th class="docinfo-name">organizations:</th><td class="field-body"><a class="reference" href="http://www.dezide.com">Dezide Aps</a> and <a class="reference" href="http://www.cs.aau.dk">Aalborg University</a></td>
</tr>
<tr><th class="docinfo-name">Date:</th>
<td>2005-08-24</td></tr>
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">WG21/N1869 and J16/05-0129</td>
</tr>
<tr class="field"><th class="docinfo-name">Working Group:</th><td class="field-body">Evolution</td>
</tr>
</tbody>
</table>
<div class="abstract topic">
<p class="topic-title first">Abstract</p>
<p>This paper provides wording for <a class="reference" href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1612.pdf">n1612</a> which proposed
to extend the complex number facility with imaginary
numbers.</p>
</div>
<!-- ######################### -->
<!-- # Roles -->
<!-- ######################### -->
<!-- ######################### -->
<div class="contents topic" id="table-of-contents">
<p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p>
<ul class="auto-toc simple">
<li><a class="reference" href="#mode-of-description" id="id1" name="id1">1&nbsp;&nbsp;&nbsp;Mode of description</a></li>
<li><a class="reference" href="#changes-to-general-requirements" id="id2" name="id2">2&nbsp;&nbsp;&nbsp;Changes to general requirements</a></li>
<li><a class="reference" href="#changes-to-synopsis-and-specification" id="id3" name="id3">3&nbsp;&nbsp;&nbsp;Changes to synopsis and specification</a><ul class="auto-toc">
<li><a class="reference" href="#discussion" id="id4" name="id4">3.1&nbsp;&nbsp;&nbsp;Discussion</a></li>
</ul>
</li>
<li><a class="reference" href="#acknowledgements" id="id5" name="id5">4&nbsp;&nbsp;&nbsp;Acknowledgements</a></li>
</ul>
</div>
<div class="section" id="mode-of-description">
<h1><a class="toc-backref" href="#id1" name="mode-of-description">1&nbsp;&nbsp;&nbsp;Mode of description</a></h1>
<ul class="simple">
<li>Strikeout means removed text, and underline means inserted text.</li>
<li>In code listings that mix old and new code, bold font means added code.</li>
</ul>
</div>
<div class="section" id="changes-to-general-requirements">
<h1><a class="toc-backref" href="#id2" name="changes-to-general-requirements">2&nbsp;&nbsp;&nbsp;Changes to general requirements</a></h1>
<p>Modify 26.2 as shown:</p>
<p>1 The header <tt class="docutils literal"><span class="pre">&lt;complex&gt;</span></tt> defines <span class="strike">a class template</span> 
<span class="u">class templates</span>, and numerous functions for representing and manipulating
complex numbers.</p>
<p>2 The effect of instantiating <span class="strike">the</span> template <tt class="docutils literal"><span class="pre">complex</span></tt> 
<span class="u">or</span> <span class="utt">imaginary</span> for any type other than float, double or long double is
unspecified.</p>
</div>
<div class="section" id="changes-to-synopsis-and-specification">
<h1><a class="toc-backref" href="#id3" name="changes-to-synopsis-and-specification">3&nbsp;&nbsp;&nbsp;Changes to synopsis and specification</a></h1>
<p>Modify 26.2.1 to:</p>
<pre class="literal-block">
namespace std {
    template&lt;class T&gt; class complex;
    template&lt;&gt; class complex&lt;float&gt;;
    template&lt;&gt; class complex&lt;double&gt;;
    template&lt;&gt; class complex&lt;long double&gt;;
    
    <strong>template&lt;class T&gt; class imaginary;
    template&lt;&gt; class imaginary&lt;float&gt;;
    template&lt;&gt; class imaginary&lt;double&gt;;
    template&lt;&gt; class imaginary&lt;long double&gt;;</strong>
    
    // 26.2.6 operators:
    
    template&lt;class T&gt; complex&lt;T&gt; operator+(const complex&lt;T&gt;&amp;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator+(const complex&lt;T&gt;&amp;, const T&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator+(const T&amp;, const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; imaginary&lt;T&gt; operator+( imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator+(T, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator+(imaginary&lt;T&gt;, T);
    template&lt;class T&gt; complex&lt;T&gt; operator+(const complex&lt;T&gt;&amp;, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator+(imaginary&lt;T&gt;, const complex&lt;T&gt;&amp;);</strong>

    template&lt;class T&gt; complex&lt;T&gt; operator-(const complex&lt;T&gt;&amp;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator-(const complex&lt;T&gt;&amp;, const T&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator-(const T&amp;, const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; imaginary&lt;T&gt; operator-(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator-(T, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator-(imaginary&lt;T&gt;, T);
    template&lt;class T&gt; complex&lt;T&gt; operator-(const complex&lt;T&gt;&amp;, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator-(imaginary&lt;T&gt;, const complex&lt;T&gt;&amp;);</strong>

    template&lt;class T&gt; complex&lt;T&gt; operator*(const complex&lt;T&gt;&amp;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator*(const complex&lt;T&gt;&amp;, const T&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator*(const T&amp;, const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; T operator*(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; imaginary&lt;T&gt; operator*(T, imaginary&lt;T&gt;);
    template&lt;class T&gt; imaginary&lt;T&gt; operator*(imaginary&lt;T&gt;, T); 
    template&lt;class T&gt; complex&lt;T&gt; operator*(const complex&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator*(imaginary&lt;T&gt;, complex&lt;T&gt;);</strong>
    
    template&lt;class T&gt; complex&lt;T&gt; operator/(const complex&lt;T&gt;&amp;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator/(const complex&lt;T&gt;&amp;, const T&amp;);
    template&lt;class T&gt; complex&lt;T&gt; operator/(const T&amp;, const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; T operator/(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; imaginary&lt;T&gt; operator/(T, imaginary&lt;T&gt;);
    template&lt;class T&gt; imaginary&lt;T&gt; operator/(imaginary&lt;T&gt;, T);
    template&lt;class T&gt; complex&lt;T&gt; operator/(const complex&lt;T&gt;&amp;, imaginary&lt;T&gt;);
    template&lt;class T&gt; complex&lt;T&gt; operator/(imaginary&lt;T&gt;, const complex&lt;T&gt;&amp;);</strong>

    template&lt;class T&gt; complex&lt;T&gt; operator+(const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; imaginary&lt;T&gt; operator+(imaginary&lt;T&gt;);</strong>
    
    template&lt;class T&gt; complex&lt;T&gt; operator-(const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; imaginary&lt;T&gt; operator-(imaginary&lt;T&gt;);</strong> 
    
    template&lt;class T&gt; bool operator==(const complex&lt;T&gt;&amp;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; bool operator==(const complex&lt;T&gt;&amp;, const T&amp;);
    template&lt;class T&gt; bool operator==(const T&amp;, const complex&lt;T&gt;&amp;); 
    <strong>template&lt;class T&gt; bool operator==(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; bool operator==(imaginary&lt;T&gt;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; bool operator==(const complex&lt;T&gt;&amp;, imaginary&lt;T&gt;);</strong> 
    
    template&lt;class T&gt; bool operator!=(const complex&lt;T&gt;&amp;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; bool operator!=(const complex&lt;T&gt;&amp;, const T&amp;);
    template&lt;class T&gt; bool operator!=(const T&amp;, const complex&lt;T&gt;&amp;);
    <strong>template&lt;class T&gt; bool operator!=(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; bool operator!=(imaginary&lt;T&gt;, const complex&lt;T&gt;&amp;);
    template&lt;class T&gt; bool operator!=(const complex&lt;T&gt;&amp;, imaginary&lt;T&gt;);</strong> 
     
    <strong>template&lt;class T&gt; bool operator&lt;(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; bool operator&lt;=(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; bool operator&gt;(imaginary&lt;T&gt;, imaginary&lt;T&gt;);
    template&lt;class T&gt; bool operator&gt;=(imaginary&lt;T&gt;, imaginary&lt;T&gt;);</strong> 
    
    template&lt;class T, class charT, class traits&gt;
    basic_istream&lt;charT, traits&gt;&amp;
    operator&gt;&gt;(basic_istream&lt;charT, traits&gt;&amp;, complex&lt;T&gt;&amp;);
    template&lt;class T, class charT, class traits&gt;
    basic_ostream&lt;charT, traits&gt;&amp;
    operator&lt;&lt;(basic_ostream&lt;charT, traits&gt;&amp;, const complex&lt;T&gt;&amp;);
</pre>
<!-- **template<class T, class charT, class traits> -->
<!-- basic_istream<charT, traits>& -->
<!-- operator>>(basic_istream<charT, traits>&, imaginary<T>&); -->
<!-- template<class T, class charT, class traits> -->
<!-- basic_ostream<charT, traits>& -->
<!-- operator<<(basic_ostream<charT, traits>&, imaginary<T>);**
    
    // 26.2.7 values:
    
    template<class T> T real(const complex<T>&);
    template<class T> T imag(const complex<T>&);
    template<class T> T abs(const complex<T>&);
    template<class T> T arg(const complex<T>&);
    template<class T> T norm(const complex<T>&);
    template<class T> complex<T> conj(const complex<T>&);
    template<class T> complex<T> polar(const T& rho, const T& theta = 0);
    
    // 26.2.8 transcendentals:
    
    template<class T> complex<T> cos (const complex<T>&);
    template<class T> complex<T> cosh (const complex<T>&);
    template<class T> complex<T> exp (const complex<T>&);
    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>&, int);
    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>&);
    template<class T> complex<T> sqrt (const complex<T>&);
    template<class T> complex<T> tan (const complex<T>&);
    template<class T> complex<T> tanh (const complex<T>&);
} -->
<p>Modify 26.2.1 to:</p>
<pre class="literal-block">
namespace std {
    template&lt;class T&gt;
    class complex {
    public:
        typedef T value_type;
        complex(const T&amp; re = T(), const T&amp; im = T());
        <strong>template&lt;class X&gt; complex( imaginary&lt;X&gt; im );
        template&lt;class X&gt; complex( X re, imaginary&lt;X&gt; im );</strong>
        complex(const complex&amp;);
        template&lt;class X&gt; complex(const complex&lt;X&gt;&amp;);
        T real() const;
        T imag() const;
        complex&lt;T&gt;&amp; operator= (const T&amp;);
        complex&lt;T&gt;&amp; operator+=(const T&amp;);
        complex&lt;T&gt;&amp; operator-=(const T&amp;);
        complex&lt;T&gt;&amp; operator*=(const T&amp;);
        complex&lt;T&gt;&amp; operator/=(const T&amp;);
        <strong>template&lt;class X&gt; complex&lt;T&gt;&amp; operator=(imaginary&lt;X&gt;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator+=(imaginary&lt;X&gt;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator-=(imaginary&lt;X&gt;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator*=(imaginary&lt;X&gt;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator/=(imaginary&lt;X&gt;);</strong>
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator=(const complex&amp;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator= (const complex&lt;X&gt;&amp;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator+=(const complex&lt;X&gt;&amp;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator-=(const complex&lt;X&gt;&amp;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator*=(const complex&lt;X&gt;&amp;);
        template&lt;class X&gt; complex&lt;T&gt;&amp; operator/=(const complex&lt;X&gt;&amp;);
    };
}
</pre>
<p>Add a new section 26.2.3 <strong>[lib.imaginary]</strong>:</p>
<pre class="literal-block">
template&lt;class T&gt;
class imaginary
{
    T imag_; // exposition only
public:
    typedef T value_type;
    imaginary( T imag = T() );
    T&amp; value();
    T  value() const;
    tempate&lt;class X&gt; imaginary&lt;T&gt;&amp; operator+=( imaginary&lt;X&gt; r );
    tempate&lt;class X&gt; imaginary&lt;T&gt;&amp; operator-=( imaginary&lt;X&gt; r );
    imaginary&lt;T&gt;&amp; operator*=( T r );
    imaginary&lt;T&gt;&amp; operator/=( T r );
};
</pre>
<p>1 The class <tt class="docutils literal"><span class="pre">imaginary</span></tt> describes an imaginary number, that is, a complex
number with zero real part.</p>
<p>Modify 26.2.1 to:</p>
<pre class="literal-block">
template&lt;&gt; class complex&lt;float&gt; {
public:
    typedef float value_type;
    complex(float re = 0.0f, float im = 0.0f);
    <strong>template&lt;class X&gt; complex( imaginary&lt;X&gt; im );
    template&lt;class X&gt; complex( X re, imaginary&lt;X&gt; im );</strong>
    explicit complex(const complex&lt;double&gt;&amp;);
    explicit complex(const complex&lt;long double&gt;&amp;);
    float real() const;
    float imag() const;
    complex&lt;float&gt;&amp; operator= (float);
    complex&lt;float&gt;&amp; operator+=(float);
    complex&lt;float&gt;&amp; operator-=(float);
    complex&lt;float&gt;&amp; operator*=(float);
    complex&lt;float&gt;&amp; operator/=(float);
    <strong>template&lt;class X&gt; complex&lt;float&gt;&amp; operator=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator+=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator-=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator*=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator/=(imaginary&lt;X&gt;);</strong>        
    complex&lt;float&gt;&amp; operator=(const complex&lt;float&gt;&amp;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator= (const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator+=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator-=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator*=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;float&gt;&amp; operator/=(const complex&lt;X&gt;&amp;);
};

template&lt;&gt; class complex&lt;double&gt; {
public:
    typedef double value_type;
    complex(double re = 0.0, double im = 0.0);
    <strong>template&lt;class X&gt; complex( imaginary&lt;X&gt; im );
    template&lt;class X&gt; complex( X re, imaginary&lt;X&gt; im );</strong>
    complex(const complex&lt;float&gt;&amp;);
    explicit complex(const complex&lt;long double&gt;&amp;);
    double real() const;
    double imag() const;
    complex&lt;double&gt;&amp; operator= (double);
    complex&lt;double&gt;&amp; operator+=(double);
    complex&lt;double&gt;&amp; operator-=(double);
    complex&lt;double&gt;&amp; operator*=(double);
    complex&lt;double&gt;&amp; operator/=(double);
    <strong>template&lt;class X&gt; complex&lt;double&gt;&amp; operator=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator+=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator-=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator*=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator/=(imaginary&lt;X&gt;);</strong>        
    complex&lt;double&gt;&amp; operator=(const complex&lt;double&gt;&amp;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator= (const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator+=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator-=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator*=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;double&gt;&amp; operator/=(const complex&lt;X&gt;&amp;);
    };

template&lt;&gt; class complex&lt;long double&gt; {
public:
    typedef long double value_type;
    complex(long double re = 0.0L, long double im = 0.0L);
    <strong>template&lt;class X&gt; complex( imaginary&lt;X&gt; im );
    template&lt;class X&gt; complex( X re, imaginary&lt;X&gt; im );</strong>        
    complex(const complex&lt;float&gt;&amp;);
    complex(const complex&lt;double&gt;&amp;);
    long double real() const;
    long double imag() const;
    complex&lt;long double&gt;&amp; operator=(const complex&lt;long double&gt;&amp;);
    complex&lt;long double&gt;&amp; operator= (long double);
    complex&lt;long double&gt;&amp; operator+=(long double);
    complex&lt;long double&gt;&amp; operator-=(long double);
    complex&lt;long double&gt;&amp; operator*=(long double);
    complex&lt;long double&gt;&amp; operator/=(long double);
    <strong>template&lt;class X&gt; complex&lt;long double&gt;&amp; operator=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator+=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator-=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator*=(imaginary&lt;X&gt;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator/=(imaginary&lt;X&gt;);</strong>                
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator= (const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator+=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator-=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator*=(const complex&lt;X&gt;&amp;);
    template&lt;class X&gt; complex&lt;long double&gt;&amp; operator/=(const complex&lt;X&gt;&amp;);
};
</pre>
<p>Add a new section 26.2.4 <strong>[lib.imaginary.special]</strong>:</p>
<pre class="literal-block">
template&lt;&gt; class imaginary&lt;float&gt; {
public:
    typedef float value_type;
    imaginary( float imag = 0.0f );
    float&amp; value();
    float  value() const;
    tempate&lt;class X&gt; imaginary&lt;float&gt;&amp; operator+=( imaginary&lt;X&gt; r );
    tempate&lt;class X&gt; imaginary&lt;float&gt;&amp; operator-=( imaginary&lt;X&gt; r );
    imaginary&lt;float&gt;&amp; operator*=( float r );
    imaginary&lt;float&gt;&amp; operator/=( float r );        
};

template&lt;&gt; class imaginary&lt;double&gt; {
public:
    typedef double value_type;
    imaginary( double imag = 0.0 );
    double&amp; value();
    double  value() const;
    tempate&lt;class X&gt; imaginary&lt;double&gt;&amp; operator+=( imaginary&lt;X&gt; r );
    tempate&lt;class X&gt; imaginary&lt;double&gt;&amp; operator-=( imaginary&lt;X&gt; r );
    imaginary&lt;double&gt;&amp; operator*=( double r );
    imaginary&lt;double&gt;&amp; operator/=( double r );
};

template&lt;&gt; class imaginary&lt;long double&gt; {
public:
    typedef long double value_type;
    imaginary( long double imag = 0.0L );
    long double&amp; value();
    long double  value() const;
    tempate&lt;class X&gt; imaginary&lt;long double&gt;&amp; operator+=( imaginary&lt;X&gt; r );
    tempate&lt;class X&gt; imaginary&lt;long double&gt;&amp; operator-=( imaginary&lt;X&gt; r );
    imaginary&lt;long double&gt;&amp; operator*=( long double r );
    imaginary&lt;long double&gt;&amp; operator/=( long double r );
};
</pre>
<p>Add the following to 26.2.4:</p>
<blockquote>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">im</span> <span class="pre">);</span></tt></p>
<p>3 <strong>Effects</strong>: Constructs an object of class <tt class="docutils literal"><span class="pre">complex</span></tt>.</p>
<p>4 <strong>Postcondition</strong>: <tt class="docutils literal"><span class="pre">real()</span> <span class="pre">==</span> <span class="pre">0</span> <span class="pre">&amp;&amp;</span> <span class="pre">imag()</span> <span class="pre">==</span> <span class="pre">im.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex(</span> <span class="pre">X</span> <span class="pre">re,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">im</span> <span class="pre">);</span></tt></p>
<p>5 <strong>Effects</strong>: Constructs an object of class <tt class="docutils literal"><span class="pre">complex</span></tt>.</p>
<p>6 <strong>Postcondition</strong>: <tt class="docutils literal"><span class="pre">real()</span> <span class="pre">==</span> <span class="pre">re</span> <span class="pre">&amp;&amp;</span> <span class="pre">imag()</span> <span class="pre">==</span> <span class="pre">im.value()</span></tt>.</p>
</blockquote>
<p>Add the following to 26.2.5:</p>
<blockquote>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex&lt;T&gt;&amp;</span> <span class="pre">operator=(imaginary&lt;X&gt;</span> <span class="pre">im);</span></tt></p>
<p><strong>Postcondition</strong>: <tt class="docutils literal"><span class="pre">real()</span> <span class="pre">==</span> <span class="pre">0</span> <span class="pre">&amp;&amp;</span> <span class="pre">imag()</span> <span class="pre">==</span> <span class="pre">im.value()</span></tt>.</p>
<p><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex&lt;T&gt;&amp;</span> <span class="pre">operator+=(imaginary&lt;X&gt;</span> <span class="pre">im);</span></tt></p>
<p><strong>Effects</strong>: Adds <tt class="docutils literal"><span class="pre">im.value()</span></tt> to the imaginary part of <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex&lt;T&gt;&amp;</span> <span class="pre">operator-=(imaginary&lt;X&gt;</span> <span class="pre">im);</span></tt></p>
<p><strong>Effects</strong>: Subtracts <tt class="docutils literal"><span class="pre">im.value()</span></tt> from the imaginary part of <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex&lt;T&gt;&amp;</span> <span class="pre">operator*=(imaginary&lt;X&gt;</span> <span class="pre">im);</span></tt></p>
<p><strong>Effects</strong>: Multiplies the imaginary number <tt class="docutils literal"><span class="pre">im</span></tt> with <tt class="docutils literal"><span class="pre">*this</span></tt>
and stores the product in <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><strong>Complexity</strong>: Faster than multiplying two complex numbers.</p>
<p><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">complex&lt;T&gt;&amp;</span> <span class="pre">operator/=(imaginary&lt;X&gt;</span> <span class="pre">im);</span></tt></p>
<p><strong>Effects</strong>: Divides <tt class="docutils literal"><span class="pre">*this</span></tt> with the imaginary number <tt class="docutils literal"><span class="pre">im</span></tt> 
and stores the product in <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><strong>Complexity</strong>: Faster than dividing two complex numbers.</p>
<p><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
</blockquote>
<p>Add a new section 26.2.6 <strong>[lib.imaginary.members]</strong>:</p>
<blockquote>
<p><tt class="docutils literal"><span class="pre">imaginary(</span> <span class="pre">T</span> <span class="pre">imag</span> <span class="pre">=</span> <span class="pre">T()</span> <span class="pre">);</span></tt></p>
<p>1 <strong>Effects</strong>: Constructs an object of class <tt class="docutils literal"><span class="pre">imaginary</span></tt>.</p>
<p>2 <strong>Postcondition</strong>: <tt class="docutils literal"><span class="pre">value()</span> <span class="pre">==</span> <span class="pre">imag</span></tt>.</p>
</blockquote>
<p>Add a new section 26.2.7 <strong>[lib.imaginary.members.ops]</strong>:</p>
<blockquote>
<p><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">value();</span></tt></p>
<p>3 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">imag_</span></tt></p>
<p><tt class="docutils literal"><span class="pre">T</span>&nbsp; <span class="pre">value()</span> <span class="pre">const;</span></tt></p>
<p>4 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">imag_</span></tt></p>
<p><tt class="docutils literal"><span class="pre">tempate&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">imaginary&lt;T&gt;&amp;</span> <span class="pre">operator+=(</span> <span class="pre">imaginary&lt;X&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<p>5 <strong>Effects</strong>: <tt class="docutils literal"><span class="pre">imag_</span> <span class="pre">+=</span> <span class="pre">r.value()</span></tt>.</p>
<p>6 <strong>returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">tempate&lt;class</span> <span class="pre">X&gt;</span> <span class="pre">imaginary&lt;T&gt;&amp;</span> <span class="pre">operator-=(</span> <span class="pre">imaginary&lt;X&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<p>7 <strong>Effects</strong>: <tt class="docutils literal"><span class="pre">imag_</span> <span class="pre">-=</span> <span class="pre">r.value()</span></tt>.</p>
<p>8 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">imaginary&lt;T&gt;&amp;</span> <span class="pre">operator*=(</span> <span class="pre">T</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<p>9 <strong>Effects</strong>: <tt class="docutils literal"><span class="pre">imag_</span> <span class="pre">*=</span> <span class="pre">r</span></tt>.</p>
<p>10 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">*this</span></tt>.</p>
</blockquote>
<p>Modify 26.2.3 to:</p>
<pre class="literal-block">
template&lt;class T&gt; complex&lt;T&gt; operator+(const complex&lt;T&gt;&amp; lhs, const complex&lt;T&gt;&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator+(const complex&lt;T&gt;&amp; lhs, const T&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator+(const T&amp; lhs, const complex&lt;T&gt;&amp; rhs);
<strong>template&lt;class T&gt; complex&lt;T&gt; operator+( T lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator+( imaginary&lt;T&gt; lhs, T rhs );
template&lt;class T&gt; complex&lt;T&gt; operator+( const complex&lt;T&gt;&amp; lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator+( imaginary&lt;T&gt; lhs, const complex&lt;T&gt;&amp; rhs );</strong>
</pre>
<dl class="docutils">
<dt>.    </dt>
<dd><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">complex&lt;T&gt;(lhs)</span> <span class="pre">+=</span> <span class="pre">rhs</span></tt>.</dd>
</dl>
<p>Modify 26.2.6 to:</p>
<pre class="literal-block">
template&lt;class T&gt; complex&lt;T&gt; operator-(const complex&lt;T&gt;&amp; lhs, const complex&lt;T&gt;&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator-(const complex&lt;T&gt;&amp; lhs, const T&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator-(const T&amp; lhs, const complex&lt;T&gt;&amp; rhs);
<strong>template&lt;class T&gt; complex&lt;T&gt; operator-( T lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator-( imaginary&lt;T&gt; lhs, T rhs );
template&lt;class T&gt; complex&lt;T&gt; operator-( const complex&lt;T&gt;&amp; lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator-( imaginary&lt;T&gt; lhs, const complex&lt;T&gt;&amp; rhs );</strong>
</pre>
<dl class="docutils">
<dt>.    </dt>
<dd><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">complex&lt;T&gt;(lhs)</span> <span class="pre">-=</span> <span class="pre">rhs</span></tt>.</dd>
</dl>
<p>Modify 26.2.7 to:</p>
<pre class="literal-block">
template&lt;class T&gt; complex&lt;T&gt; operator*(const complex&lt;T&gt;&amp; lhs, const complex&lt;T&gt;&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator*(const complex&lt;T&gt;&amp; lhs, const T&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator*(const T&amp; lhs, const complex&lt;T&gt;&amp; rhs);
<strong>template&lt;class T&gt; complex&lt;T&gt; operator*( const complex&lt;T&gt;&amp; lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator*( imaginary&lt;T&gt; lhs, const complex&lt;T&gt;&amp; rhs );</strong>
</pre>
<dl class="docutils">
<dt>.    </dt>
<dd><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">complex&lt;T&gt;(lhs)</span> <span class="pre">*=</span> <span class="pre">rhs</span></tt>.</dd>
</dl>
<p>Modify 26.2.8 to:</p>
<pre class="literal-block">
template&lt;class T&gt; complex&lt;T&gt; operator/(const complex&lt;T&gt;&amp; lhs, const complex&lt;T&gt;&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator/(const complex&lt;T&gt;&amp; lhs, const T&amp; rhs);
template&lt;class T&gt; complex&lt;T&gt; operator/(const T&amp; lhs, const complex&lt;T&gt;&amp; rhs);
<strong>template&lt;class T&gt; complex&lt;T&gt; operator/( const complex&lt;T&gt;&amp; lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator/( imaginary&lt;T&gt; lhs, const complex&lt;T&gt;&amp; rhs );</strong>
</pre>
<dl class="docutils">
<dt>.    </dt>
<dd><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">complex&lt;T&gt;(lhs)</span> <span class="pre">/=</span> <span class="pre">rhs</span></tt>.</dd>
</dl>
<p>Modify 26.2.9 to:</p>
<pre class="literal-block">
template&lt;class T&gt; bool operator==(const complex&lt;T&gt;&amp; lhs, const complex&lt;T&gt;&amp; rhs);
template&lt;class T&gt; bool operator==(const complex&lt;T&gt;&amp; lhs, const T&amp; rhs);
template&lt;class T&gt; bool operator==(const T&amp; lhs, const complex&lt;T&gt;&amp; rhs);
<strong>template&lt;class T&gt; complex&lt;T&gt; operator==( const complex&lt;T&gt;&amp; lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator==( imaginary&lt;T&gt; lhs, const complex&lt;T&gt;&amp; rhs );</strong>
</pre>
<dl class="docutils">
<dt>.</dt>
<dd><p class="first"><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.real()</span> <span class="pre">==</span> <span class="pre">rhs.real()</span> <span class="pre">&amp;&amp;</span> <span class="pre">lhs.imag()</span> <span class="pre">==</span> <span class="pre">rhs.imag()</span></tt>.</p>
<p class="last"><strong>Notes</strong>: The imaginary part is assumed to be <tt class="docutils literal"><span class="pre">T()</span></tt>, or <tt class="docutils literal"><span class="pre">0.0</span></tt>, for the <tt class="docutils literal"><span class="pre">T</span></tt> arguments.
<span class="u">The real part is assumed to be 0.0 for imaginary&lt;T&gt; arguments.</span></p>
</dd>
</dl>
<p>Modify 26.2.10 to:</p>
<pre class="literal-block">
template&lt;class T&gt; bool operator!=(const complex&lt;T&gt;&amp; lhs, const complex&lt;T&gt;&amp; rhs);
template&lt;class T&gt; bool operator!=(const complex&lt;T&gt;&amp; lhs, const T&amp; rhs);
template&lt;class T&gt; bool operator!=(const T&amp; lhs, const complex&lt;T&gt;&amp; rhs);
<strong>template&lt;class T&gt; complex&lt;T&gt; operator!=( const complex&lt;T&gt;&amp; lhs, imaginary&lt;T&gt; rhs );
template&lt;class T&gt; complex&lt;T&gt; operator!=( imaginary&lt;T&gt; lhs, const complex&lt;T&gt;&amp; rhs );</strong>
</pre>
<dl class="docutils">
<dt>.</dt>
<dd><p class="first"><strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.real()</span> <span class="pre">!=</span> <span class="pre">rhs.real()</span> <span class="pre">||</span> <span class="pre">lhs.imag()</span> <span class="pre">!=</span> <span class="pre">rhs.imag()</span></tt>.</p>
<p class="last"><span class="u">Notes: The imaginary part is assumed to be T(), or 0.0, for the T arguments.
The real part is assumed to be 0.0 for imaginary&lt;T&gt; arguments.</span></p>
</dd>
</dl>
<p>Add a new section 26.2.7 <strong>[lib.imaginary.ops]</strong></p>
<blockquote>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator+(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>1 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs</span> <span class="pre">+=</span> <span class="pre">rhs</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator-(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>2 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs</span> <span class="pre">-=</span> <span class="pre">rhs</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">T</span> <span class="pre">operator*(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>3 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">-</span> <span class="pre">lhs.value()</span> <span class="pre">*</span> <span class="pre">rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator*(</span> <span class="pre">T</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>4 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">rhs</span> <span class="pre">*=</span> <span class="pre">lhs</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator*(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">T</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>5 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs</span> <span class="pre">*=</span> <span class="pre">rhs</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">T</span> <span class="pre">operator/(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>6 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()/rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator/(T</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>7 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">imaginary&lt;T&gt;(</span> <span class="pre">lhs/rhs.value()</span> <span class="pre">)</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator/(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">T</span> <span class="pre">rhs);</span></tt></p>
<p>8 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs</span> <span class="pre">/=</span> <span class="pre">rhs</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator+(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>9 <strong>Notes</strong>: unary operator.</p>
<p>10 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">rhs</span></tt>;</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">operator-(</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs</span> <span class="pre">);</span></tt></p>
<p>11 <strong>Notes</strong>: unary operator.</p>
<p>12 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">rhs</span> <span class="pre">*=</span> <span class="pre">-1.</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">bool</span> <span class="pre">operator==(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>13 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()</span> <span class="pre">==</span> <span class="pre">rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">bool</span> <span class="pre">operator!=(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>14 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()</span> <span class="pre">!=</span> <span class="pre">rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">bool</span> <span class="pre">operator&lt;(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>15 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()</span> <span class="pre">&lt;</span> <span class="pre">rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">bool</span> <span class="pre">operator&lt;=(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>16 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()</span> <span class="pre">&lt;=</span> <span class="pre">rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">bool</span> <span class="pre">operator&gt;(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>17 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()</span> <span class="pre">&gt;</span> <span class="pre">rhs.value()</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">T&gt;</span> <span class="pre">bool</span> <span class="pre">operator&gt;=(imaginary&lt;T&gt;</span> <span class="pre">lhs,</span> <span class="pre">imaginary&lt;T&gt;</span> <span class="pre">rhs);</span></tt></p>
<p>18 <strong>Returns</strong>: <tt class="docutils literal"><span class="pre">lhs.value()</span> <span class="pre">&gt;=</span> <span class="pre">rhs.value()</span></tt>.</p>
</blockquote>
<div class="section" id="discussion">
<h2><a class="toc-backref" href="#id4" name="discussion">3.1&nbsp;&nbsp;&nbsp;Discussion</a></h2>
<ol class="arabic simple">
<li>should we change all <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span></tt> arguments to <tt class="docutils literal"><span class="pre">T</span></tt>? Or
should we write <tt class="docutils literal"><span class="pre">const</span> <span class="pre">imaginary&lt;T&gt;&amp;</span></tt> instead of <tt class="docutils literal"><span class="pre">imaginary&lt;T&gt;</span></tt>?.</li>
<li>why is some member functions function templates and others not (eg. <tt class="docutils literal"><span class="pre">operator+=()</span></tt>)?</li>
<li>is it acceptable that all functions on complex numbers are function templates
and so will not allow implicit conversion if passed imaginary numbers?</li>
<li>why do the specialization of <tt class="docutils literal"><span class="pre">complex</span></tt> not directly define
the member function templates 
(eg. why does <tt class="docutils literal"><span class="pre">complex&lt;float&gt;::operator=(complex&lt;float&gt;)</span></tt> exist)?.</li>
<li><tt class="docutils literal"><span class="pre">operator&lt;&lt;()</span></tt> is not provided for <tt class="docutils literal"><span class="pre">imaginary&lt;T&gt;</span></tt> since this should
rather be done for the whole standard library at some point.</li>
<li><tt class="docutils literal"><span class="pre">operator+/-(T,imaginary&lt;T&gt;)</span></tt> could be given its own specification.
It is here assumed that compilers will optimize the redundant 
double initialization of the imaginary number away.</li>
</ol>
</div>
</div>
<div class="section" id="acknowledgements">
<h1><a class="toc-backref" href="#id5" name="acknowledgements">4&nbsp;&nbsp;&nbsp;Acknowledgements</a></h1>
<p>The author would like to thank Bill Plauger.</p>
<!-- ############################################### -->
<!-- ################## Links ###################### -->
<!-- ############################################### -->
<!-- ========= -->
<!-- Footnotes -->
<!-- ========= -->
<!-- ############################################### -->
<!-- ################## Footnotes ################## -->
<!-- ############################################### -->
</div>
</div>
</body>
</html>
