C ++ tanh () - C ++ Standardbibliothek

Die Funktion tanh () in C ++ gibt die hyperbolische Tangente eines Winkels im Bogenmaß zurück.

Die Funktion ist in der Header-Datei definiert.

 (Mathematik) tanh x = tanh (x) (In der C ++ - Programmierung)

tanh () Prototyp (Stand C ++ 11 Standard)

doppeltes Tanh (doppeltes x); float tanh (float x); langes doppeltes Tanh (langes doppeltes x); Doppel-Tanh (T x); // Für integralen Typ

Die tanh () Funktion nimmt ein einziges Argument in Radianten und gibt den hyperbolischen Tangens dieses Winkels in Typ double, floatoder long doubleTyp.

Die hyperbolische Tangente von x ist gegeben durch:

tanh () Parameter

Die Funktion tanh () verwendet ein einzelnes obligatorisches Argument, das einen hyperbolischen Winkel im Bogenmaß darstellt.

tanh () Rückgabewert

Die Funktion tanh () gibt den hyperbolischen Tangens des Arguments zurück.

Beispiel 1: Wie funktioniert die Funktion tanh () in C ++?

 #include #include using namespace std; int main() ( double x = 0.50, result; result = tanh(x); cout << "tanh(x) = " << result << endl; // x in Degrees double xDegrees = 90; x = xDegrees * 3.14159/180; result = tanh(x); cout << "tanh(x) = " << result << endl; return 0; ) 

Wenn Sie das Programm ausführen, lautet die Ausgabe wie folgt:

 tanh (x) = 0,462117 tanh (x) = 0,917152 

Beispiel 2: tanh () -Funktion mit Integraltyp

 #include #include using namespace std; int main() ( int x = 5; double result; result = tanh(x); cout << "tanh(x) = " << result << endl; return 0; ) 

Wenn Sie das Programm ausführen, lautet die Ausgabe wie folgt:

 tanh (x) = 0,999909

Interessante Beiträge...