Funkcja acosh () w C ++ zwraca łuk hiperboliczny cosinus (odwrotny cosinus hiperboliczny) liczby w radianach.
Funkcja acosh () przyjmuje pojedynczy argument i zwraca łuk hiperboliczny cosinus tej wartości w radianach.
Funkcja jest zdefiniowana w pliku nagłówkowym.
(Matematyka) cosh -1 x = acosh (x) (W programowaniu w C ++)
acosh () prototyp (w standardzie C ++ 11)
podwójne acosh (podwójne x); float acosh (float x); długi podwójny acosh (długi podwójny x); podwójny acosh (T x); // Dla typu całkowitego
acosh () Parametry
Funkcja acosh () przyjmuje jeden obowiązkowy argument, który jest większy lub równy 1.
Jeśli argument jest mniejszy niż 1, występuje błąd domeny.
acosh () Wartość zwracana
Funkcja acosh () zwraca wartość z zakresu (0, ∞) .
Jeśli argument przekazany do acosh () jest mniejszy niż 1, zwraca NaN
(nie jest liczbą).
Parametr | Wartość zwracana |
---|---|
x> = 1 | (0, ∞) |
x <1 | NaN |
Przykład 1: Jak funkcja acosh () działa w C ++?
#include #include #define PI 3.141592654 using namespace std; int main() ( double x = 13.21, result; result = acosh(x); cout << "acosh(x) = " << result << " radian" << endl; // result in degrees cout << "acosh(x) = " << result*180/PI << " degree" << endl; return 0; )
Po uruchomieniu programu wynik będzie następujący:
acosh (x) = 3,27269 radian acosh (x) = 187,511 stopnia
Przykład 2: funkcja acosh () z typem całkowitym
#include #include #define PI 3.141592654 using namespace std; int main() ( int x = 4; double result; result = acosh(x); cout << "acosh(x) = " << result << " radian" << endl; // result in degrees cout << "acosh(x) = " << result*180/PI << " degree" << endl; return 0; )
Po uruchomieniu programu wynik będzie następujący:
acosh (x) = 2,06344 radian acosh (x) = 118,226 stopnia