C ++ tanh () - C ++ standaardbibliotheek

De functie tanh () in C ++ retourneert de hyperbolische tangens van een hoek in radialen.

De functie is gedefinieerd in het header-bestand.

 (Wiskunde) tanh x = tanh (x) (In C ++ programmeren)

tanh () prototype (vanaf C ++ 11 standaard)

dubbele tanh (dubbele x); float tanh (float x); lange dubbele tanh (lange dubbele x); dubbele tanh (T x); // Voor integraal type

De functie tanh () draait één argument in radialen en retourneert de hyperbolische tangens van die hoek in type double, floatof long doubletype.

De hyperbolische tangens van x wordt gegeven door,

tanh () Parameters

De functie tanh () accepteert één verplicht argument dat een hyperbolische hoek in radialen vertegenwoordigt.

tanh () Retourwaarde

De functie tanh () geeft de tangens hyperbolicus van het argument terug.

Voorbeeld 1: hoe werkt de functie 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; ) 

Wanneer u het programma uitvoert, is de uitvoer:

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

Voorbeeld 2: tanh () functie met integraal type

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

Wanneer u het programma uitvoert, is de uitvoer:

 tanh (x) = 0,999909

Interessante artikelen...