C asin () - C Standardbibliothek

Die Funktion asin () gibt den Bogensinus (inversen Sinus) einer Zahl im Bogenmaß zurück.

Die asin()Funktion verwendet ein einzelnes Argument (1 ≧ x ≧ -1) und gibt den Bogensinus im Bogenmaß zurück.

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

asin () Prototyp

 doppeltes Asin (doppeltes x);

Um Sinus Typ zu finden Bogen int, floatoder long doublekönnen Sie explizit den Typ konvertieren doublemit Cast - Operator.

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

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

float asinf (float x); langes doppeltes asinl (langes doppeltes x);

asin () Parameter

Die asin()Funktion akzeptiert ein einzelnes Argument im Bereich von (-1, +1). Dies liegt daran, dass der Sinuswert im Bereich von 1 bis -1 liegt.

Parameter Beschreibung
doppelter Wert Erforderlich. Ein doppelter Wert zwischen - 1 und +1 einschließlich.

asin () Rückgabewert

Die asin()Funktionen geben den Wert im Bereich von (-π / 2, + π / 2) im Bogenmaß zurück. Wenn der an die asin()Funktion übergebene Parameter kleiner als -1 oder größer als 1 ist, gibt die Funktion NaN (keine Zahl) zurück.

Parameter (x) Rückgabewert
x = (-1, +1) (-π / 2, + π / 2) im Bogenmaß
-1> x oder x> 1 NaN (keine Zahl)

Beispiel 1: asin () -Funktion mit verschiedenen Parametern

 #include #include int main() ( // constant PI is defined const double PI = 3.1415926; double x, result; x = -0.5; result = asin(x); printf("Inverse of sin(%.2f) = %.2lf in radians", x, result); // converting radians to degree result = asin(x)*180/PI; printf("Inverse of sin(%.2f) = %.2lf in degrees", x, result); // paramter not in range x = 1.2; result = asin(x); printf("Inverse of sin(%.2f) = %.2lf", x, result); return 0; ) 

Ausgabe

 Inverse von sin (-0,50) = -0,52 im Bogenmaß Inverse von sin (-0,50) = -30,00 in Grad Inverse von sin (1,20) = nan 

Beispiel 2: asinf () und asinl () Funktion

 #include #include int main() ( float fx, fasinx; long double lx, ldasinx; // arc sinine of type float fx = -0.505405; fasinx = asinf(fx); // arc sinine of type long double lx = -0.50540593; ldasinx = asinf(lx); printf("asinf(x) = %f in radians", fasinx); printf("asinl(x) = %Lf in radians", ldasinx); return 0; )

Ausgabe

 asinf (x) = -0,529851 im Bogenmaß asinl (x) = -0,529852 im Bogenmaß 

Interessante Beiträge...