function template
<valarray>

std::sinh

template<class T> valarray<T> sinh (const valarray<T>& x);
Compute hyperbolic sine of valarray elements
Returns a valarray containing the hyperbolic sines of all the elements of x, in the same order.

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

This function overloads cmath's sinh.

Parameters

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

Return value

A valarray object with the hyperbolic 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
// sinh valarray example
#include <iostream> // std::cout
#include <cstddef> // std::size_t
#include <cmath> // std::sinh(double)
#include <valarray> // std::valarray, std::sinh(valarray)
int main ()
{
 double val[] = {0.35, 1.22, 3.4};
 std::valarray<double> foo (val,3);
 std::valarray<double> bar = sinh (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.35 1.22 3.4
bar: 0.35719 1.54598 14.9654


See also

sinh (cmath)
Compute hyperbolic sine (function)
cosh
Compute hyperbolic cosine of valarray elements (function template)
tanh
Compute hyperbolic tangent of valarray elements (function template)

AltStyle によって変換されたページ (->オリジナル) /