Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/complex/pow"

From cppreference.com
< cpp‎ | numeric‎ | complex
Line 5: Line 5:
 
{{ddcl list item | 1=
 
{{ddcl list item | 1=
 
template< class T >  
 
template< class T >  
complex<T> pow( const complex<T>& base, const complex<T>& exp );
+
complex<T> pow( const complex<T>& x, const complex<T>& y);
 
}}
 
}}
 
{{ddcl list item | 1=
 
{{ddcl list item | 1=
 
template< class T >  
 
template< class T >  
complex<T> pow( const complex<T>& base, const T& exp );
+
complex<T> pow( const complex<T>& x, const T& y);
 
}}
 
}}
 
{{ddcl list item | 1=
 
{{ddcl list item | 1=
 
template< class T >  
 
template< class T >  
complex<T> pow( const T& base, const complex<T>& exp );
+
complex<T> pow( const T& x, const complex<T>& y);
 
}}
 
}}
 
{{ddcl list item | notes={{mark since c++11}} | 1=
 
{{ddcl list item | notes={{mark since c++11}} | 1=
 
template< class T, class U >  
 
template< class T, class U >  
std::complex</*Promoted*/> pow( const complex<T>& base, const complex<U>& exp );
+
complex</*Promoted*/> pow( const complex<T>& x, const complex<U>& y);
 
}}
 
}}
 
{{ddcl list item | notes={{mark since c++11}} | 1=
 
{{ddcl list item | notes={{mark since c++11}} | 1=
 
template< class T, class U >  
 
template< class T, class U >  
std::complex</*Promoted*/> pow( const complex<T>& base, const U& exp );
+
complex</*Promoted*/> pow( const complex<T>& x, const U& y);
 
}}
 
}}
 
{{ddcl list item | notes={{mark since c++11}} | 1=
 
{{ddcl list item | notes={{mark since c++11}} | 1=
 
template< class T, class U >  
 
template< class T, class U >  
std::complex</*Promoted*/> pow( const U& base, const complex<T>& exp );
+
complex</*Promoted*/> pow( const T& x, const complex<U>& y);
 
}}
 
}}
 
{{ddcl list end}}
 
{{ddcl list end}}
  
Computes complex {{tt|base}} raised to a complex power {{tt|exp}}. The operation is defined as {{math|exp(''base'' &middot; log(''exp'')}}. A branch cut exists along the negative real axis.
+
Computes complex {{tt|x}} raised to a complex power {{tt|y}}. The operation is defined as {{math|exp(''y'' &middot; log(''x'') )}}. A branch cut exists along the negative real axis.
  
 
The result of {{c|pow(0, 0)}} is implementation-defined.
 
The result of {{c|pow(0, 0)}} is implementation-defined.
Line 35: Line 35:
 
{{mark since c++11}}Additional overloads are provided for all arithmetic types, such that
 
{{mark since c++11}}Additional overloads are provided for all arithmetic types, such that
 
:1. If either argument is {{c|long double}} or {{c|std::complex<long double>}}, then both arguments are cast to {{c|std::complex<long double>}}  
 
:1. If either argument is {{c|long double}} or {{c|std::complex<long double>}}, then both arguments are cast to {{c|std::complex<long double>}}  
:2. Otherwise, if either argument is {{c|double}}, {{c|complex<double>}} or integer type, then both arguments are cast to {{c|std::complex<double>}}  
+
:2. Otherwise, if either argument is {{c|double}}, {{c|std::complex<double>}} or integer type, then both arguments are cast to {{c|std::complex<double>}}  
:3. Otherwise, if either argument is {{c|float}} or {{c|complex<float>}}, then both arguments are cast to {{c|std::complex<float>}}  
+
:3. Otherwise, if either argument is {{c|float}} or {{c|std::complex<float>}}, then both arguments are cast to {{c|std::complex<float>}}  
  
 
===Parameters===
 
===Parameters===
 
{{param list begin}}
 
{{param list begin}}
{{param list item | base | base as a complex value}}
+
{{param list item | x | base as a complex value}}
{{param list item | exp | exponent as a complex value}}
+
{{param list item | y | exponent as a complex value}}
 
{{param list end}}
 
{{param list end}}
  
 
===Return value===
 
===Return value===
  
{{tt|base}} raised to a power {{tt|exp}}.
+
{{tt|x}} raised to a power {{tt|y}}.
  
 
===See also===
 
===See also===

Revision as of 22:09, 23 April 2013

 
 
 
 

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <complex>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class T >
complex<T> pow( const complex<T>& x, const complex<T>& y);
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class T >
complex<T> pow( const complex<T>& x, const T& y);
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class T >
complex<T> pow( const T& x, const complex<T>& y);
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class U >
complex</*Promoted*/> pow( const complex<T>& x, const complex<U>& y);
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class U >
complex</*Promoted*/> pow( const complex<T>& x, const U& y);
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class U >
complex</*Promoted*/> pow( const T& x, const complex<U>& y);
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Computes complex x raised to a complex power y. The operation is defined as exp(y · log(x) ). A branch cut exists along the negative real axis.

The result of pow(0, 0) is implementation-defined.

(since C++11)Additional overloads are provided for all arithmetic types, such that

1. If either argument is long double or std::complex<long double>, then both arguments are cast to std::complex<long double>
2. Otherwise, if either argument is double, std::complex<double> or integer type, then both arguments are cast to std::complex<double>
3. Otherwise, if either argument is float or std::complex<float>, then both arguments are cast to std::complex<float>

Parameters

x - base as a complex value
y - exponent as a complex value

Return value

x raised to a power y.

See also

Template:cpp/numeric/complex/dcl list expTemplate:cpp/numeric/complex/dcl list sqrt