Funkcja atanh () w C ++ zwraca łukową styczną hiperboliczną (odwrotną tangens hiperboliczny) liczby w radianach.
Funkcja atanh () przyjmuje pojedynczy argument i zwraca łuk hiperboliczny tangens tej wartości w radianach.
Funkcja jest zdefiniowana w pliku nagłówkowym.
(Matematyka) tanh -1 x = atanh (x) (W programowaniu w C ++)
atanh () prototyp (w standardzie C ++ 11)
podwójne atanh (podwójne x); float atanh (float x); długi podwójny atanh (długi podwójny x); podwójne atanh (T x); // Dla typu całkowitego
atanh () Parametry
Funkcja atanh () przyjmuje jeden obowiązkowy argument z zakresu (-1, 1).
Jeśli wartość jest większa niż 1 lub mniejsza niż -1, występuje błąd domeny.
atanh () Zwracana wartość
Funkcja atanh () zwraca odwrotną tangens hiperboliczny przekazanego argumentu.
atnah () Tabela wartości zwracanychParametr (x) | Wartość zwracana |
---|---|
-1 <x <1 | Wartość skończona |
x = -1 | -∞ |
x = 1 | ∞ |
x 1 | NaN (nie jest liczbą |
Przykład 1: Jak funkcja atanh () działa w C ++?
#include #include #define PI 3.141592654 using namespace std; int main() ( double x = 0.32, result; result = atanh(x); cout << "atanh(x) = " << result << " radian" << endl; // result in degrees cout << "atanh(x) = " << result*180/PI << " degree" << endl; return 0; )
Po uruchomieniu programu wynik będzie następujący:
atanh (x) = 0,331647 radiana atanh (x) = 19,002 stopnia
Przykład 2: funkcja atanh () z typem całkowitym
#include #include #define PI 3.141592654 using namespace std; int main() ( int x = 1; double result; result = atanh(x); cout << "atanh(x) = " << result << " radian" << endl; // result in degrees cout << "atanh(x) = " << result*180/PI << " degree" << endl; return 0; )
Po uruchomieniu programu wynik będzie następujący:
atanh (x) = inf radian atanh (x) = inf stopień