- tmp/tmpvetaet_l/{from.md → to.md} +114 -62
tmp/tmpvetaet_l/{from.md → to.md}
RENAMED
|
@@ -3,14 +3,14 @@
|
|
| 3 |
### General <a id="complex.numbers.general">[[complex.numbers.general]]</a>
|
| 4 |
|
| 5 |
The header `<complex>` defines a class template, and numerous functions
|
| 6 |
for representing and manipulating complex numbers.
|
| 7 |
|
| 8 |
-
The effect of instantiating the template `complex` for any
|
| 9 |
-
not a cv-unqualified floating-point type
|
| 10 |
-
unspecified. Specializations of `complex` for
|
| 11 |
-
floating-point types are trivially
|
| 12 |
[[term.literal.type]].
|
| 13 |
|
| 14 |
If the result of a function is not mathematically defined or not in the
|
| 15 |
range of representable values for its type, the behavior is undefined.
|
| 16 |
|
|
@@ -23,14 +23,14 @@ If `z` is an lvalue of type cv `complex<T>` then:
|
|
| 23 |
`z`.
|
| 24 |
|
| 25 |
Moreover, if `a` is an expression of type cv `complex<T>*` and the
|
| 26 |
expression `a[i]` is well-defined for an integer expression `i`, then:
|
| 27 |
|
| 28 |
-
- `reinterpret_cast<cv T*>(a)[2*i]` designates the real part of
|
| 29 |
-
and
|
| 30 |
-
- `reinterpret_cast<cv T*>(a)[2*i + 1]` designates the imaginary part
|
| 31 |
-
`a[i]`.
|
| 32 |
|
| 33 |
### Header `<complex>` synopsis <a id="complex.syn">[[complex.syn]]</a>
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
namespace std {
|
|
@@ -68,42 +68,56 @@ namespace std {
|
|
| 68 |
|
| 69 |
// [complex.value.ops], values
|
| 70 |
template<class T> constexpr T real(const complex<T>&);
|
| 71 |
template<class T> constexpr T imag(const complex<T>&);
|
| 72 |
|
| 73 |
-
template<class T> T abs(const complex<T>&);
|
| 74 |
-
template<class T> T arg(const complex<T>&);
|
| 75 |
template<class T> constexpr T norm(const complex<T>&);
|
| 76 |
|
| 77 |
template<class T> constexpr complex<T> conj(const complex<T>&);
|
| 78 |
-
template<class T> complex<T> proj(const complex<T>&);
|
| 79 |
-
template<class T> complex<T> polar(const T&, const T& = T());
|
| 80 |
|
| 81 |
// [complex.transcendentals], transcendentals
|
| 82 |
-
template<class T> complex<T> acos(const complex<T>&);
|
| 83 |
-
template<class T> complex<T> asin(const complex<T>&);
|
| 84 |
-
template<class T> complex<T> atan(const complex<T>&);
|
| 85 |
|
| 86 |
-
template<class T> complex<T> acosh(const complex<T>&);
|
| 87 |
-
template<class T> complex<T> asinh(const complex<T>&);
|
| 88 |
-
template<class T> complex<T> atanh(const complex<T>&);
|
| 89 |
|
| 90 |
-
template<class T> complex<T> cos (const complex<T>&);
|
| 91 |
-
template<class T> complex<T> cosh (const complex<T>&);
|
| 92 |
-
template<class T> complex<T> exp (const complex<T>&);
|
| 93 |
-
template<class T> complex<T> log (const complex<T>&);
|
| 94 |
-
template<class T> complex<T> log10(const complex<T>&);
|
| 95 |
|
| 96 |
-
template<class T> complex<T> pow (const complex<T>&, const T&);
|
| 97 |
-
template<class T> complex<T> pow (const complex<T>&, const complex<T>&);
|
| 98 |
-
template<class T> complex<T> pow (const T&, const complex<T>&);
|
| 99 |
|
| 100 |
-
template<class T> complex<T> sin (const complex<T>&);
|
| 101 |
-
template<class T> complex<T> sinh (const complex<T>&);
|
| 102 |
-
template<class T> complex<T> sqrt (const complex<T>&);
|
| 103 |
-
template<class T> complex<T> tan (const complex<T>&);
|
| 104 |
-
template<class T> complex<T> tanh (const complex<T>&);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
// [complex.literals], complex literals
|
| 107 |
inline namespace literals {
|
| 108 |
inline namespace complex_literals {
|
| 109 |
constexpr complex<long double> operator""il(long double);
|
|
@@ -234,10 +248,19 @@ constexpr complex& operator/=(const T& rhs);
|
|
| 234 |
*Effects:* Divides the scalar value `rhs` into the complex value `*this`
|
| 235 |
and stores the result in `*this`.
|
| 236 |
|
| 237 |
*Returns:* `*this`.
|
| 238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
``` cpp
|
| 240 |
template<class X> constexpr complex& operator+=(const complex<X>& rhs);
|
| 241 |
```
|
| 242 |
|
| 243 |
*Effects:* Adds the complex value `rhs` to the complex value `*this` and
|
|
@@ -384,17 +407,17 @@ template<class T> constexpr T imag(const complex<T>& x);
|
|
| 384 |
```
|
| 385 |
|
| 386 |
*Returns:* `x.imag()`.
|
| 387 |
|
| 388 |
``` cpp
|
| 389 |
-
template<class T> T abs(const complex<T>& x);
|
| 390 |
```
|
| 391 |
|
| 392 |
*Returns:* The magnitude of `x`.
|
| 393 |
|
| 394 |
``` cpp
|
| 395 |
-
template<class T> T arg(const complex<T>& x);
|
| 396 |
```
|
| 397 |
|
| 398 |
*Returns:* The phase angle of `x`, or `atan2(imag(x), real(x))`.
|
| 399 |
|
| 400 |
``` cpp
|
|
@@ -408,103 +431,103 @@ template<class T> constexpr complex<T> conj(const complex<T>& x);
|
|
| 408 |
```
|
| 409 |
|
| 410 |
*Returns:* The complex conjugate of `x`.
|
| 411 |
|
| 412 |
``` cpp
|
| 413 |
-
template<class T> complex<T> proj(const complex<T>& x);
|
| 414 |
```
|
| 415 |
|
| 416 |
*Returns:* The projection of `x` onto the Riemann sphere.
|
| 417 |
|
| 418 |
*Remarks:* Behaves the same as the C function `cproj`. See also: ISO C
|
| 419 |
7.3.9.5
|
| 420 |
|
| 421 |
``` cpp
|
| 422 |
-
template<class T> complex<T> polar(const T& rho, const T& theta = T());
|
| 423 |
```
|
| 424 |
|
| 425 |
*Preconditions:* `rho` is non-negative and non-NaN. `theta` is finite.
|
| 426 |
|
| 427 |
*Returns:* The `complex` value corresponding to a complex number whose
|
| 428 |
magnitude is `rho` and whose phase angle is `theta`.
|
| 429 |
|
| 430 |
### Transcendentals <a id="complex.transcendentals">[[complex.transcendentals]]</a>
|
| 431 |
|
| 432 |
``` cpp
|
| 433 |
-
template<class T> complex<T> acos(const complex<T>& x);
|
| 434 |
```
|
| 435 |
|
| 436 |
*Returns:* The complex arc cosine of `x`.
|
| 437 |
|
| 438 |
*Remarks:* Behaves the same as the C function `cacos`. See also: ISO C
|
| 439 |
7.3.5.1
|
| 440 |
|
| 441 |
``` cpp
|
| 442 |
-
template<class T> complex<T> asin(const complex<T>& x);
|
| 443 |
```
|
| 444 |
|
| 445 |
*Returns:* The complex arc sine of `x`.
|
| 446 |
|
| 447 |
*Remarks:* Behaves the same as the C function `casin`. See also: ISO C
|
| 448 |
7.3.5.2
|
| 449 |
|
| 450 |
``` cpp
|
| 451 |
-
template<class T> complex<T> atan(const complex<T>& x);
|
| 452 |
```
|
| 453 |
|
| 454 |
*Returns:* The complex arc tangent of `x`.
|
| 455 |
|
| 456 |
*Remarks:* Behaves the same as the C function `catan`. See also: ISO C
|
| 457 |
7.3.5.3
|
| 458 |
|
| 459 |
``` cpp
|
| 460 |
-
template<class T> complex<T> acosh(const complex<T>& x);
|
| 461 |
```
|
| 462 |
|
| 463 |
*Returns:* The complex arc hyperbolic cosine of `x`.
|
| 464 |
|
| 465 |
*Remarks:* Behaves the same as the C function `cacosh`. See also: ISO C
|
| 466 |
7.3.6.1
|
| 467 |
|
| 468 |
``` cpp
|
| 469 |
-
template<class T> complex<T> asinh(const complex<T>& x);
|
| 470 |
```
|
| 471 |
|
| 472 |
*Returns:* The complex arc hyperbolic sine of `x`.
|
| 473 |
|
| 474 |
*Remarks:* Behaves the same as the C function `casinh`. See also: ISO C
|
| 475 |
7.3.6.2
|
| 476 |
|
| 477 |
``` cpp
|
| 478 |
-
template<class T> complex<T> atanh(const complex<T>& x);
|
| 479 |
```
|
| 480 |
|
| 481 |
*Returns:* The complex arc hyperbolic tangent of `x`.
|
| 482 |
|
| 483 |
*Remarks:* Behaves the same as the C function `catanh`. See also: ISO C
|
| 484 |
7.3.6.3
|
| 485 |
|
| 486 |
``` cpp
|
| 487 |
-
template<class T> complex<T> cos(const complex<T>& x);
|
| 488 |
```
|
| 489 |
|
| 490 |
*Returns:* The complex cosine of `x`.
|
| 491 |
|
| 492 |
``` cpp
|
| 493 |
-
template<class T> complex<T> cosh(const complex<T>& x);
|
| 494 |
```
|
| 495 |
|
| 496 |
*Returns:* The complex hyperbolic cosine of `x`.
|
| 497 |
|
| 498 |
``` cpp
|
| 499 |
-
template<class T> complex<T> exp(const complex<T>& x);
|
| 500 |
```
|
| 501 |
|
| 502 |
*Returns:* The complex base-e exponential of `x`.
|
| 503 |
|
| 504 |
``` cpp
|
| 505 |
-
template<class T> complex<T> log(const complex<T>& x);
|
| 506 |
```
|
| 507 |
|
| 508 |
*Returns:* The complex natural (base-e) logarithm of `x`. For all `x`,
|
| 509 |
`imag(log(x))` lies in the interval \[-π, π\].
|
| 510 |
|
|
@@ -512,44 +535,44 @@ template<class T> complex<T> log(const complex<T>& x);
|
|
| 512 |
in C++ as they are for `clog` in C. — *end note*]
|
| 513 |
|
| 514 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 515 |
|
| 516 |
``` cpp
|
| 517 |
-
template<class T> complex<T> log10(const complex<T>& x);
|
| 518 |
```
|
| 519 |
|
| 520 |
*Returns:* The complex common (base-10) logarithm of `x`, defined as
|
| 521 |
`log(x) / log(10)`.
|
| 522 |
|
| 523 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 524 |
|
| 525 |
``` cpp
|
| 526 |
-
template<class T> complex<T> pow(const complex<T>& x, const complex<T>& y);
|
| 527 |
-
template<class T> complex<T> pow(const complex<T>& x, const T& y);
|
| 528 |
-
template<class T> complex<T> pow(const T& x, const complex<T>& y);
|
| 529 |
```
|
| 530 |
|
| 531 |
*Returns:* The complex power of base `x` raised to the `y`ᵗʰ power,
|
| 532 |
defined as `exp(y * log(x))`. The value returned for `pow(0, 0)` is
|
| 533 |
*implementation-defined*.
|
| 534 |
|
| 535 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 536 |
|
| 537 |
``` cpp
|
| 538 |
-
template<class T> complex<T> sin(const complex<T>& x);
|
| 539 |
```
|
| 540 |
|
| 541 |
*Returns:* The complex sine of `x`.
|
| 542 |
|
| 543 |
``` cpp
|
| 544 |
-
template<class T> complex<T> sinh(const complex<T>& x);
|
| 545 |
```
|
| 546 |
|
| 547 |
*Returns:* The complex hyperbolic sine of `x`.
|
| 548 |
|
| 549 |
``` cpp
|
| 550 |
-
template<class T> complex<T> sqrt(const complex<T>& x);
|
| 551 |
```
|
| 552 |
|
| 553 |
*Returns:* The complex square root of `x`, in the range of the right
|
| 554 |
half-plane.
|
| 555 |
|
|
@@ -557,45 +580,74 @@ half-plane.
|
|
| 557 |
in C++ as they are for `csqrt` in C. — *end note*]
|
| 558 |
|
| 559 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 560 |
|
| 561 |
``` cpp
|
| 562 |
-
template<class T> complex<T> tan(const complex<T>& x);
|
| 563 |
```
|
| 564 |
|
| 565 |
*Returns:* The complex tangent of `x`.
|
| 566 |
|
| 567 |
``` cpp
|
| 568 |
-
template<class T> complex<T> tanh(const complex<T>& x);
|
| 569 |
```
|
| 570 |
|
| 571 |
*Returns:* The complex hyperbolic tangent of `x`.
|
| 572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
### Additional overloads <a id="cmplx.over">[[cmplx.over]]</a>
|
| 574 |
|
| 575 |
-
The following function templates
|
| 576 |
|
| 577 |
``` cpp
|
| 578 |
arg norm
|
| 579 |
conj proj
|
| 580 |
imag real
|
| 581 |
```
|
| 582 |
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
The additional overloads shall be sufficient to ensure:
|
| 586 |
|
| 587 |
- If the argument has a floating-point type `T`, then it is effectively
|
| 588 |
cast to `complex<T>`.
|
| 589 |
- Otherwise, if the argument has integer type, then it is effectively
|
| 590 |
cast to `complex<double>`.
|
| 591 |
|
| 592 |
-
Function template `pow` has additional overloads sufficient to
|
| 593 |
-
for a call with one argument of type `complex<T1>` and the other
|
| 594 |
argument of type `T2` or `complex<T2>`, both arguments are effectively
|
| 595 |
-
cast to `complex<common_type_t<T1,
|
| 596 |
-
|
|
|
|
| 597 |
|
| 598 |
### Suffixes for complex number literals <a id="complex.literals">[[complex.literals]]</a>
|
| 599 |
|
| 600 |
This subclause describes literal suffixes for constructing complex
|
| 601 |
number literals. The suffixes `i`, `il`, and `if` create complex numbers
|
|
|
|
| 3 |
### General <a id="complex.numbers.general">[[complex.numbers.general]]</a>
|
| 4 |
|
| 5 |
The header `<complex>` defines a class template, and numerous functions
|
| 6 |
for representing and manipulating complex numbers.
|
| 7 |
|
| 8 |
+
The effect of instantiating the primary template of `complex` for any
|
| 9 |
+
type that is not a cv-unqualified floating-point type
|
| 10 |
+
[[basic.fundamental]] is unspecified. Specializations of `complex` for
|
| 11 |
+
cv-unqualified floating-point types are trivially copyable literal types
|
| 12 |
[[term.literal.type]].
|
| 13 |
|
| 14 |
If the result of a function is not mathematically defined or not in the
|
| 15 |
range of representable values for its type, the behavior is undefined.
|
| 16 |
|
|
|
|
| 23 |
`z`.
|
| 24 |
|
| 25 |
Moreover, if `a` is an expression of type cv `complex<T>*` and the
|
| 26 |
expression `a[i]` is well-defined for an integer expression `i`, then:
|
| 27 |
|
| 28 |
+
- `reinterpret_cast<cv T*>(a)[2 * i]` designates the real part of
|
| 29 |
+
`a[i]`, and
|
| 30 |
+
- `reinterpret_cast<cv T*>(a)[2 * i + 1]` designates the imaginary part
|
| 31 |
+
of `a[i]`.
|
| 32 |
|
| 33 |
### Header `<complex>` synopsis <a id="complex.syn">[[complex.syn]]</a>
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
namespace std {
|
|
|
|
| 68 |
|
| 69 |
// [complex.value.ops], values
|
| 70 |
template<class T> constexpr T real(const complex<T>&);
|
| 71 |
template<class T> constexpr T imag(const complex<T>&);
|
| 72 |
|
| 73 |
+
template<class T> constexpr T abs(const complex<T>&);
|
| 74 |
+
template<class T> constexpr T arg(const complex<T>&);
|
| 75 |
template<class T> constexpr T norm(const complex<T>&);
|
| 76 |
|
| 77 |
template<class T> constexpr complex<T> conj(const complex<T>&);
|
| 78 |
+
template<class T> constexpr complex<T> proj(const complex<T>&);
|
| 79 |
+
template<class T> constexpr complex<T> polar(const T&, const T& = T());
|
| 80 |
|
| 81 |
// [complex.transcendentals], transcendentals
|
| 82 |
+
template<class T> constexpr complex<T> acos(const complex<T>&);
|
| 83 |
+
template<class T> constexpr complex<T> asin(const complex<T>&);
|
| 84 |
+
template<class T> constexpr complex<T> atan(const complex<T>&);
|
| 85 |
|
| 86 |
+
template<class T> constexpr complex<T> acosh(const complex<T>&);
|
| 87 |
+
template<class T> constexpr complex<T> asinh(const complex<T>&);
|
| 88 |
+
template<class T> constexpr complex<T> atanh(const complex<T>&);
|
| 89 |
|
| 90 |
+
template<class T> constexpr complex<T> cos (const complex<T>&);
|
| 91 |
+
template<class T> constexpr complex<T> cosh (const complex<T>&);
|
| 92 |
+
template<class T> constexpr complex<T> exp (const complex<T>&);
|
| 93 |
+
template<class T> constexpr complex<T> log (const complex<T>&);
|
| 94 |
+
template<class T> constexpr complex<T> log10(const complex<T>&);
|
| 95 |
|
| 96 |
+
template<class T> constexpr complex<T> pow (const complex<T>&, const T&);
|
| 97 |
+
template<class T> constexpr complex<T> pow (const complex<T>&, const complex<T>&);
|
| 98 |
+
template<class T> constexpr complex<T> pow (const T&, const complex<T>&);
|
| 99 |
|
| 100 |
+
template<class T> constexpr complex<T> sin (const complex<T>&);
|
| 101 |
+
template<class T> constexpr complex<T> sinh (const complex<T>&);
|
| 102 |
+
template<class T> constexpr complex<T> sqrt (const complex<T>&);
|
| 103 |
+
template<class T> constexpr complex<T> tan (const complex<T>&);
|
| 104 |
+
template<class T> constexpr complex<T> tanh (const complex<T>&);
|
| 105 |
+
|
| 106 |
+
// [complex.tuple], tuple interface
|
| 107 |
+
template<class T> struct tuple_size;
|
| 108 |
+
template<size_t I, class T> struct tuple_element;
|
| 109 |
+
template<class T> struct tuple_size<complex<T>>;
|
| 110 |
+
template<size_t I, class T> struct tuple_element<I, complex<T>>;
|
| 111 |
+
template<size_t I, class T>
|
| 112 |
+
constexpr T& get(complex<T>&) noexcept;
|
| 113 |
+
template<size_t I, class T>
|
| 114 |
+
constexpr T&& get(complex<T>&&) noexcept;
|
| 115 |
+
template<size_t I, class T>
|
| 116 |
+
constexpr const T& get(const complex<T>&) noexcept;
|
| 117 |
+
template<size_t I, class T>
|
| 118 |
+
constexpr const T&& get(const complex<T>&&) noexcept;
|
| 119 |
|
| 120 |
// [complex.literals], complex literals
|
| 121 |
inline namespace literals {
|
| 122 |
inline namespace complex_literals {
|
| 123 |
constexpr complex<long double> operator""il(long double);
|
|
|
|
| 248 |
*Effects:* Divides the scalar value `rhs` into the complex value `*this`
|
| 249 |
and stores the result in `*this`.
|
| 250 |
|
| 251 |
*Returns:* `*this`.
|
| 252 |
|
| 253 |
+
``` cpp
|
| 254 |
+
template<class X> constexpr complex& operator=(const complex<X>& rhs);
|
| 255 |
+
```
|
| 256 |
+
|
| 257 |
+
*Effects:* Assigns the value `rhs.real()` to the real part and the value
|
| 258 |
+
`rhs.imag()` to the imaginary part of the complex value `*this`.
|
| 259 |
+
|
| 260 |
+
*Returns:* `*this`.
|
| 261 |
+
|
| 262 |
``` cpp
|
| 263 |
template<class X> constexpr complex& operator+=(const complex<X>& rhs);
|
| 264 |
```
|
| 265 |
|
| 266 |
*Effects:* Adds the complex value `rhs` to the complex value `*this` and
|
|
|
|
| 407 |
```
|
| 408 |
|
| 409 |
*Returns:* `x.imag()`.
|
| 410 |
|
| 411 |
``` cpp
|
| 412 |
+
template<class T> constexpr T abs(const complex<T>& x);
|
| 413 |
```
|
| 414 |
|
| 415 |
*Returns:* The magnitude of `x`.
|
| 416 |
|
| 417 |
``` cpp
|
| 418 |
+
template<class T> constexpr T arg(const complex<T>& x);
|
| 419 |
```
|
| 420 |
|
| 421 |
*Returns:* The phase angle of `x`, or `atan2(imag(x), real(x))`.
|
| 422 |
|
| 423 |
``` cpp
|
|
|
|
| 431 |
```
|
| 432 |
|
| 433 |
*Returns:* The complex conjugate of `x`.
|
| 434 |
|
| 435 |
``` cpp
|
| 436 |
+
template<class T> constexpr complex<T> proj(const complex<T>& x);
|
| 437 |
```
|
| 438 |
|
| 439 |
*Returns:* The projection of `x` onto the Riemann sphere.
|
| 440 |
|
| 441 |
*Remarks:* Behaves the same as the C function `cproj`. See also: ISO C
|
| 442 |
7.3.9.5
|
| 443 |
|
| 444 |
``` cpp
|
| 445 |
+
template<class T> constexpr complex<T> polar(const T& rho, const T& theta = T());
|
| 446 |
```
|
| 447 |
|
| 448 |
*Preconditions:* `rho` is non-negative and non-NaN. `theta` is finite.
|
| 449 |
|
| 450 |
*Returns:* The `complex` value corresponding to a complex number whose
|
| 451 |
magnitude is `rho` and whose phase angle is `theta`.
|
| 452 |
|
| 453 |
### Transcendentals <a id="complex.transcendentals">[[complex.transcendentals]]</a>
|
| 454 |
|
| 455 |
``` cpp
|
| 456 |
+
template<class T> constexpr complex<T> acos(const complex<T>& x);
|
| 457 |
```
|
| 458 |
|
| 459 |
*Returns:* The complex arc cosine of `x`.
|
| 460 |
|
| 461 |
*Remarks:* Behaves the same as the C function `cacos`. See also: ISO C
|
| 462 |
7.3.5.1
|
| 463 |
|
| 464 |
``` cpp
|
| 465 |
+
template<class T> constexpr complex<T> asin(const complex<T>& x);
|
| 466 |
```
|
| 467 |
|
| 468 |
*Returns:* The complex arc sine of `x`.
|
| 469 |
|
| 470 |
*Remarks:* Behaves the same as the C function `casin`. See also: ISO C
|
| 471 |
7.3.5.2
|
| 472 |
|
| 473 |
``` cpp
|
| 474 |
+
template<class T> constexpr complex<T> atan(const complex<T>& x);
|
| 475 |
```
|
| 476 |
|
| 477 |
*Returns:* The complex arc tangent of `x`.
|
| 478 |
|
| 479 |
*Remarks:* Behaves the same as the C function `catan`. See also: ISO C
|
| 480 |
7.3.5.3
|
| 481 |
|
| 482 |
``` cpp
|
| 483 |
+
template<class T> constexpr complex<T> acosh(const complex<T>& x);
|
| 484 |
```
|
| 485 |
|
| 486 |
*Returns:* The complex arc hyperbolic cosine of `x`.
|
| 487 |
|
| 488 |
*Remarks:* Behaves the same as the C function `cacosh`. See also: ISO C
|
| 489 |
7.3.6.1
|
| 490 |
|
| 491 |
``` cpp
|
| 492 |
+
template<class T> constexpr complex<T> asinh(const complex<T>& x);
|
| 493 |
```
|
| 494 |
|
| 495 |
*Returns:* The complex arc hyperbolic sine of `x`.
|
| 496 |
|
| 497 |
*Remarks:* Behaves the same as the C function `casinh`. See also: ISO C
|
| 498 |
7.3.6.2
|
| 499 |
|
| 500 |
``` cpp
|
| 501 |
+
template<class T> constexpr complex<T> atanh(const complex<T>& x);
|
| 502 |
```
|
| 503 |
|
| 504 |
*Returns:* The complex arc hyperbolic tangent of `x`.
|
| 505 |
|
| 506 |
*Remarks:* Behaves the same as the C function `catanh`. See also: ISO C
|
| 507 |
7.3.6.3
|
| 508 |
|
| 509 |
``` cpp
|
| 510 |
+
template<class T> constexpr complex<T> cos(const complex<T>& x);
|
| 511 |
```
|
| 512 |
|
| 513 |
*Returns:* The complex cosine of `x`.
|
| 514 |
|
| 515 |
``` cpp
|
| 516 |
+
template<class T> constexpr complex<T> cosh(const complex<T>& x);
|
| 517 |
```
|
| 518 |
|
| 519 |
*Returns:* The complex hyperbolic cosine of `x`.
|
| 520 |
|
| 521 |
``` cpp
|
| 522 |
+
template<class T> constexpr complex<T> exp(const complex<T>& x);
|
| 523 |
```
|
| 524 |
|
| 525 |
*Returns:* The complex base-e exponential of `x`.
|
| 526 |
|
| 527 |
``` cpp
|
| 528 |
+
template<class T> constexpr complex<T> log(const complex<T>& x);
|
| 529 |
```
|
| 530 |
|
| 531 |
*Returns:* The complex natural (base-e) logarithm of `x`. For all `x`,
|
| 532 |
`imag(log(x))` lies in the interval \[-π, π\].
|
| 533 |
|
|
|
|
| 535 |
in C++ as they are for `clog` in C. — *end note*]
|
| 536 |
|
| 537 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 538 |
|
| 539 |
``` cpp
|
| 540 |
+
template<class T> constexpr complex<T> log10(const complex<T>& x);
|
| 541 |
```
|
| 542 |
|
| 543 |
*Returns:* The complex common (base-10) logarithm of `x`, defined as
|
| 544 |
`log(x) / log(10)`.
|
| 545 |
|
| 546 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 547 |
|
| 548 |
``` cpp
|
| 549 |
+
template<class T> constexpr complex<T> pow(const complex<T>& x, const complex<T>& y);
|
| 550 |
+
template<class T> constexpr complex<T> pow(const complex<T>& x, const T& y);
|
| 551 |
+
template<class T> constexpr complex<T> pow(const T& x, const complex<T>& y);
|
| 552 |
```
|
| 553 |
|
| 554 |
*Returns:* The complex power of base `x` raised to the `y`ᵗʰ power,
|
| 555 |
defined as `exp(y * log(x))`. The value returned for `pow(0, 0)` is
|
| 556 |
*implementation-defined*.
|
| 557 |
|
| 558 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 559 |
|
| 560 |
``` cpp
|
| 561 |
+
template<class T> constexpr complex<T> sin(const complex<T>& x);
|
| 562 |
```
|
| 563 |
|
| 564 |
*Returns:* The complex sine of `x`.
|
| 565 |
|
| 566 |
``` cpp
|
| 567 |
+
template<class T> constexpr complex<T> sinh(const complex<T>& x);
|
| 568 |
```
|
| 569 |
|
| 570 |
*Returns:* The complex hyperbolic sine of `x`.
|
| 571 |
|
| 572 |
``` cpp
|
| 573 |
+
template<class T> constexpr complex<T> sqrt(const complex<T>& x);
|
| 574 |
```
|
| 575 |
|
| 576 |
*Returns:* The complex square root of `x`, in the range of the right
|
| 577 |
half-plane.
|
| 578 |
|
|
|
|
| 580 |
in C++ as they are for `csqrt` in C. — *end note*]
|
| 581 |
|
| 582 |
*Remarks:* The branch cuts are along the negative real axis.
|
| 583 |
|
| 584 |
``` cpp
|
| 585 |
+
template<class T> constexpr complex<T> tan(const complex<T>& x);
|
| 586 |
```
|
| 587 |
|
| 588 |
*Returns:* The complex tangent of `x`.
|
| 589 |
|
| 590 |
``` cpp
|
| 591 |
+
template<class T> constexpr complex<T> tanh(const complex<T>& x);
|
| 592 |
```
|
| 593 |
|
| 594 |
*Returns:* The complex hyperbolic tangent of `x`.
|
| 595 |
|
| 596 |
+
### Tuple interface <a id="complex.tuple">[[complex.tuple]]</a>
|
| 597 |
+
|
| 598 |
+
``` cpp
|
| 599 |
+
template<class T>
|
| 600 |
+
struct tuple_size<complex<T>> : integral_constant<size_t, 2> {};
|
| 601 |
+
|
| 602 |
+
template<size_t I, class T>
|
| 603 |
+
struct tuple_element<I, complex<T>> {
|
| 604 |
+
using type = T;
|
| 605 |
+
};
|
| 606 |
+
```
|
| 607 |
+
|
| 608 |
+
*Mandates:* `I < 2` is `true`.
|
| 609 |
+
|
| 610 |
+
``` cpp
|
| 611 |
+
template<size_t I, class T>
|
| 612 |
+
constexpr T& get(complex<T>& z) noexcept;
|
| 613 |
+
template<size_t I, class T>
|
| 614 |
+
constexpr T&& get(complex<T>&& z) noexcept;
|
| 615 |
+
template<size_t I, class T>
|
| 616 |
+
constexpr const T& get(const complex<T>& z) noexcept;
|
| 617 |
+
template<size_t I, class T>
|
| 618 |
+
constexpr const T&& get(const complex<T>&& z) noexcept;
|
| 619 |
+
```
|
| 620 |
+
|
| 621 |
+
*Mandates:* `I < 2` is `true`.
|
| 622 |
+
|
| 623 |
+
*Returns:* A reference to the real part of `z` if `I == 0` is `true`,
|
| 624 |
+
otherwise a reference to the imaginary part of `z`.
|
| 625 |
+
|
| 626 |
### Additional overloads <a id="cmplx.over">[[cmplx.over]]</a>
|
| 627 |
|
| 628 |
+
The following function templates have additional constexpr overloads:
|
| 629 |
|
| 630 |
``` cpp
|
| 631 |
arg norm
|
| 632 |
conj proj
|
| 633 |
imag real
|
| 634 |
```
|
| 635 |
|
| 636 |
+
The additional constexpr overloads are sufficient to ensure:
|
|
|
|
|
|
|
| 637 |
|
| 638 |
- If the argument has a floating-point type `T`, then it is effectively
|
| 639 |
cast to `complex<T>`.
|
| 640 |
- Otherwise, if the argument has integer type, then it is effectively
|
| 641 |
cast to `complex<double>`.
|
| 642 |
|
| 643 |
+
Function template `pow` has additional constexpr overloads sufficient to
|
| 644 |
+
ensure, for a call with one argument of type `complex<T1>` and the other
|
| 645 |
argument of type `T2` or `complex<T2>`, both arguments are effectively
|
| 646 |
+
cast to `complex<common_type_t<T1, T3>>`, where `T3` is `double` if `T2`
|
| 647 |
+
is an integer type and `T2` otherwise. If `common_type_t<T1, T3>` is not
|
| 648 |
+
well-formed, then the program is ill-formed.
|
| 649 |
|
| 650 |
### Suffixes for complex number literals <a id="complex.literals">[[complex.literals]]</a>
|
| 651 |
|
| 652 |
This subclause describes literal suffixes for constructing complex
|
| 653 |
number literals. The suffixes `i`, `il`, and `if` create complex numbers
|