C acosh () - C Standardbibliothek

Die Funktion acosh () gibt den bogenhyperbolischen Cosinus (inversen hyperbolischen Cosinus) einer Zahl im Bogenmaß zurück.

Die acosh()Funktion verwendet ein einzelnes Argument (x ≧ 1) und gibt den bogenhyperbolischen Kosinus im Bogenmaß zurück.

Die acosh()Funktion ist in der Header-Datei enthalten.

acosh () Prototyp

 Doppel-Acosh (doppeltes x);

Um arc Hyperbelkosinus Typ int, floatoder long doublekönnen Sie explizit den Typ konvertieren doublemit Cast - Operator.

int x = 0; doppeltes Ergebnis; Ergebnis = acosh (doppelt (x));

Auch zwei Funktionen acoshf () und acoshl () wurden in C99 zur Arbeit spezifisch mit Typ eingeführt floatund long doubleverbunden.

float acoshf (float x); langes doppeltes acoshl (langes doppeltes x);

acosh () Parameter und Rückgabewert

Die acosh()Funktion akzeptiert ein einzelnes Argument größer oder gleich 1.

Parameter Beschreibung
doppelter Wert Erforderlich. Ein Doppelwert größer oder gleich 1 (x ≧ 1).

acosh () Rückgabewert

Die acosh()Funktionen geben eine Zahl größer oder gleich 0 im Bogenmaß zurück. Wenn das übergebene Argument kleiner als 1 ist (x <1), gibt die Funktion NaN (keine Zahl) zurück.

Parameter (x) Rückgabewert
x ≧ 1 eine Zahl größer oder gleich 0 (im Bogenmaß)
x <1 NaN (keine Zahl)

Beispiel 1: acosh () -Funktion mit verschiedenen Parametern

 #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; )

Ausgabe

 acosh (5,90) = 2,46 im Bogenmaß acosh (5,90) = 141,00 in Grad acosh (0,50) = nan 

Beispiel 2: acosh () für INFINITY und 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; ) 

Mögliche Ausgabe

 Maximalwert von acosh () im Bogenmaß = 710.476 Wenn unendlich an acosh () übergeben wird, ist result = inf 

Hier DBL_MAXin definierten float.hHeader - Datei ist die maximal darstellbare endliche Gleitkommazahl. Und INFINITYdefiniert in math.hist ein konstanter Ausdruck, der eine positive Unendlichkeit darstellt.

Beispiel 3: Funktion acoshf () und acoshl ()

 #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; ) 

Ausgabe

 acoshf (x) = 2,390524 im Bogenmaß acoshl (x) = 2,390525 im Bogenmaß 

Interessante Beiträge...