# std::asin(std::complex)

> C++ Atlas: `cppatlas.com/w/cpp/numeric/complex/asin` | Source: https://en.cppreference.com/w/cpp/numeric/complex/asin | Domain: Numerics | Standards: C++11

Computes complex arc sine of a complex value z. Branch cut exists outside the interval [−1, +1] along the real axis.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <complex>

template< class T >
std::complex<T> asin( const std::complex<T>& z ); // (since C++11)
```

Computes complex arc sine of a complex value `z`. Branch cut exists outside the interval [−1, +1] along the real axis.

### Parameters

- `z` - complex value

### Return value

If no errors occur, complex arc sine of `z` is returned, in the range of a strip unbounded along the imaginary axis and in the interval [−π/2, +π/2] along the real axis.

Errors and special cases are handled as if the operation is implemented by `-i * std::asinh(i * z)`, where `i` is the imaginary unit.

### Notes

Inverse sine (or arc sine) is a multivalued function and requires a branch cut on the complex plane. The branch cut is conventionally placed at the line segments (-∞,-1) and (1,∞) of the real axis.

The mathematical definition of the principal value of arc sine is arcsin z = -*i*ln(*i*z + √1-z²).

For any

`z`

,

asin(z) = acos(-z) - π
2

.

### Example

```cpp
#include <cmath>
#include <complex>
#include <iostream>

int main()
{
    std::cout << std::fixed;
    std::complex<double> z1(-2.0, 0.0);
    std::cout << "asin" << z1 << " = " << std::asin(z1) << '\n';

    std::complex<double> z2(-2.0, -0.0);
    std::cout << "asin" << z2 << " (the other side of the cut) = "
              << std::asin(z2) << '\n';

    // for any z, asin(z) = acos(−z) − pi / 2
    const double pi = std::acos(-1);
    std::complex<double> z3 = std::acos(z2) - pi / 2;
    std::cout << "sin(acos" << z2 << " - pi / 2) = " << std::sin(z3) << '\n';
}
```

Output:

```text
asin(-2.000000,0.000000) = (-1.570796,1.316958)
asin(-2.000000,-0.000000) (the other side of the cut) = (-1.570796,-1.316958)
sin(acos(-2.000000,-0.000000) - pi / 2) = (2.000000,0.000000)
```

### See also

- [`acos(std::complex)`](https://en.cppreference.com/w/cpp/numeric/complex/acos) (C++11): computes arc cosine of a complex number (arccos(z)) (function template)
- [`atan(std::complex)`](https://en.cppreference.com/w/cpp/numeric/complex/atan) (C++11): computes arc tangent of a complex number (arctan(z)) (function template)
- [`sin(std::complex)`](https://en.cppreference.com/w/cpp/numeric/complex/sin): computes sine of a complex number (sin(z)) (function template)
- [`asin`](https://en.cppreference.com/w/cpp/numeric/math/asin), [`asinf`](https://en.cppreference.com/w/cpp/numeric/math/asin) (C++11), [`asinl`](https://en.cppreference.com/w/cpp/numeric/math/asin) (C++11): computes arc sine (arcsin(x)) (function)
- [`asin(std::valarray)`](https://en.cppreference.com/w/cpp/numeric/valarray/asin): applies the function `std::asin` to each element of valarray (function template)
- [C documentation for `casin`](https://en.cppreference.com/w/c/numeric/complex/casin)

---
Attribution: content from https://en.cppreference.com/w/cpp/numeric/complex/asin (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.