C ++ cosh () - C ++ standaardbibliotheek

De functie cosh () in C ++ retourneert de cosinus hyperbolicus van een hoek in radialen.

De functie is gedefinieerd in het header-bestand.

 (Wiskunde) cosh x = cosh (x) (in C ++ programmeren)

cosh () prototype (vanaf C ++ 11-standaard)

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

De functie cosh () accepteert één argument in radialen en retourneert de cosinus hyperbolicus van die hoek in double, floatof long doubletype.

De hyperbolische cosinus van x wordt gegeven door,

cosh () Parameters

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

cosh () Retourwaarde

De functie cosh () retourneert de cosinus hyperbolicus van het argument.

Als de omvang van het resultaat te groot is om te worden weergegeven door een waarde van het retourtype, keert de functie terug HUGE_VALmet het juiste teken en treedt er een overloopbereikfout op.

Voorbeeld 1: hoe cosh () functie werkt?

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

Wanneer u het programma uitvoert, is de uitvoer:

 cosh (x) = 47.3215 cosh (x) = 2.50918

Voorbeeld 2: cosh () functie met integraal type

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

Wanneer u het programma uitvoert, is de uitvoer:

 cosh (x) = 10,0179 

Interessante artikelen...