Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
valarray
classes:
gslice
gslice_array
indirect_array
mask_array
slice
slice_array
valarray
global functions:
abs
acos
asin
atan
atan2
cos
cosh
exp
log
log10
pow
sin
sinh
sqrt
tan
tanh


asin

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

Compute arc sine of valarray elements

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

This function overloads cmath's asin function.

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>
#include <cmath>
#include <valarray>
using namespace std;
int main ()
{
  double val[] = {0.0, 0.25, 0.5, 0.75, 1.0};
  valarray<double> foo (val,5);
  valarray<double> bar = asin (foo);
  cout << "foo: ";
  for (size_t i=0; i<foo.size(); ++i)
	  cout << foo[i] << ' ';
  cout << endl;
  cout << "bar: ";
  for (size_t i=0; i<bar.size(); ++i)
	  cout << bar[i] << ' ';
  cout << endl;
  return 0;
}


Output:

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

See also