A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/valarray/asin/ below:

function template

<valarray>

std::asin
template<class T> valarray<T> asin (const valarray<T>& x);

Compute arc sine of valarray elements

Returns a valarray object containing the principal values of the arc sine of all the elements of x, expressed in radians, in the same order.

The function calls acos (unqualified) once for each element.

This function overloads cmath's asin.



Parameters
x
valarray containing elements of a type for which the unary function asin is defined.

Return value A valarray object with the arc sine values of the elements of x.

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// asin valarray example
#include <iostream>     // std::cout
#include <cstddef>      // std::size_t
#include <cmath>        // std::asin(double)
#include <valarray>     // std::valarray, std::asin(valarray)

int main ()
{
  double val[] = {0.0, 0.25, 0.5, 0.75, 1.0};
  std::valarray<double> foo (val,5);

  std::valarray<double> bar = asin (foo);

  std::cout << "foo:";
  for (std::size_t i=0; i<foo.size(); ++i)
    std::cout << ' ' << foo[i];
  std::cout << '\n';

  std::cout << "bar:";
  for (std::size_t i=0; i<bar.size(); ++i)
    std::cout << ' ' << bar[i];
  std::cout << '\n';

  return 0;
}

Output:
foo: 0 0.25 0.5 0.75 1
bar: 0 0.25268 0.523599 0.848062 1.5708


See also
asin (cmath)
Compute arc sine (function)
sin
Compute sine of valarray elements (function template)
acos
Compute arc cosine of valarray elements (function template)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4