C acosh () - C Standard Library

De functie acosh () retourneert de arc hyperbolische cosinus (inverse hyperbolische cosinus) van een getal in radialen.

De acosh()functie accepteert één argument (x ≧ 1) en geeft de hyperbolische cosinus van de boog in radialen terug.

De acosh()functie is opgenomen in het header-bestand.

acosh () Prototype

 dubbele acosh (dubbele x);

Om erachter boog hyperbolische cosinus van het type int, floatof long double, kunt u expliciet converteren het type om doublemet behulp van cast operator.

int x = 0; dubbel resultaat; resultaat = acosh (dubbel (x));

Ook zijn twee functies acoshf () en acoshl () geïntroduceerd in C99 om specifiek te werken met respectievelijk type floaten long double.

zweven acoshf (zweven x); lange dubbele acoshl (lange dubbele x);

acosh () Parameter en retourwaarde

De acosh()functie accepteert één argument groter dan of gelijk aan 1.

Parameter Omschrijving
dubbele waarde Verplicht. Een dubbele waarde groter dan of gelijk aan 1 (x ≧ 1).

acosh () Retourwaarde

De acosh()functie retourneert een getal groter dan of gelijk aan 0 in radialen. Als het doorgegeven argument kleiner is dan 1 (x <1), retourneert de functie NaN (geen getal).

Parameter (x) Winstwaarde
x ≧ 1 een getal groter dan of gelijk aan 0 (in radialen)
x <1 NaN (geen nummer)

Voorbeeld 1: acosh () functie met verschillende parameters

 #include #include int main() ( // constant PI is defined const double PI = 3.1415926; double x, result; x = 5.9; result = acosh(x); printf("acosh(%.2f) = %.2lf in radians", x, result); // converting radians to degree result = acosh(x)*180/PI; printf("acosh(%.2f) = %.2lf in degrees", x, result); // parameter not in range x = 0.5; result = acosh(x); printf("acosh(%.2f) = %.2lf", x, result); return 0; )

Uitvoer

 acosh (5,90) = 2,46 in radialen acosh (5,90) = 141,00 in graden acosh (0,50) = nan 

Voorbeeld 2: acosh () voor INFINITY en DBL_MAX

 #include #include #include int main() ( double x, result; // maximum representable finite floating-point number x = DBL_MAX; result = acosh(x); printf("Maximum value of acosh() in radians = %.3lf", result); // Infinity x = INFINITY; result = acosh(x); printf("When infinity is passed to acosh(), result = %.3lf", result); return 0; ) 

Mogelijke output

 Maximale waarde van acosh () in radialen = 710.476 Als oneindigheid wordt doorgegeven aan acosh (), is resultaat = inf 

Hier, DBL_MAXgedefinieerd in het float.hheader-bestand, is het maximaal representeerbare eindige drijvende-kommagetal. En INFINITYgedefinieerd in math.his een constante uitdrukking die positieve oneindigheid vertegenwoordigt.

Voorbeeld 3: acoshf () en acoshl () functie

 #include #include int main() ( float fx, facosx; long double lx, ldacosx; // arc hyperbolic cosine of type float fx = 5.5054; facosx = acoshf(fx); // arc hyperbolic cosine of type long double lx = 5.50540593; ldacosx = acoshl(lx); printf("acoshf(x) = %f in radians", facosx); printf("acoshl(x) = %Lf in radians", ldacosx); return 0; ) 

Uitvoer

 acoshf (x) = 2.390524 in radialen acoshl (x) = 2.390525 in radialen 

Interessante artikelen...