Namespaces
Variants

asin, asinf, asinl

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators
Definiert im Header <math.h>
float asinf ( float arg ) ;
(1) (seit C99)
double asin ( double arg ) ;
(2)
long double asinl ( long double arg ) ;
(3) (seit C99)
_Decimal32  asind32 ( _Decimal32 arg ) ;
(4) (seit C23)
_Decimal64  asind64 ( _Decimal64 arg ) ;
(5) (seit C23)
_Decimal128 asind128 ( _Decimal128 arg ) ;
(6) (seit C23)
Definiert im Header <tgmath.h>
#define asin( arg )
(7) (seit C99)
1-6) Berechnet die Hauptwerte des Arkussinus von arg .
7) Typgenerisches Makro: Wenn das Argument den Typ long double hat, (3) ( asinl ) wird aufgerufen. Andernfalls, wenn das Argument einen Ganzzahltyp oder den Typ double hat, (2) ( asin ) wird aufgerufen. Andernfalls (1) ( asinf ) wird aufgerufen. Wenn das Argument komplex ist, ruft das Makro die entsprechende komplexe Funktion auf ( casinf , casin , casinl ).

Die Funktionen (4-6) werden genau dann deklariert, wenn die Implementierung __STDC_IEC_60559_DFP__ vordefiniert (d.h. die Implementierung unterstützt dezimale Gleitkommazahlen).

(seit C23)

Inhaltsverzeichnis

Parameter

arg - Gleitkommawert

Rückgabewert

If no errors occur, the arc sine of arg ( arcsin(arg) ) in the range [-
π
2
; +
π
2
]
, is returned.

Wenn ein Domänenfehler auftritt, wird ein implementierungsdefinierter Wert zurückgegeben (NaN, falls unterstützt).

Wenn ein Bereichsfehler aufgrund von Unterlauf auftritt, wird das korrekte Ergebnis (nach Rundung) zurückgegeben.

Fehlerbehandlung

Fehler werden gemeldet, wie in math_errhandling festgelegt.

Ein Domänenfehler tritt auf, wenn arg außerhalb des Bereichs [-1.0; 1.0] liegt.

Wenn die Implementierung IEEE-Gleitkommaarithmetik (IEC 60559) unterstützt:

  • wenn das Argument ±0 ist, wird es unverändert zurückgegeben;
  • wenn |arg| > 1 , tritt ein Domänenfehler auf und NaN wird zurückgegeben;
  • wenn das Argument NaN ist, wird NaN zurückgegeben.

Beispiel

#include <errno.h>
#include <fenv.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#ifndef __GNUC__
#pragma STDC FENV_ACCESS ON
#endif
int main(void)
{
    printf("asin( 1.0) = %+f, 2*asin( 1.0)=%+f\n", asin(1), 2 * asin(1));
    printf("asin(-0.5) = %+f, 6*asin(-0.5)=%+f\n", asin(-0.5), 6 * asin(-0.5));
    // Spezielle Werte
    printf("asin(0.0) = %1f, asin(-0.0)=%f\n", asin(+0.0), asin(-0.0));
    // Fehlerbehandlung
    errno = 0; feclearexcept(FE_ALL_EXCEPT);
    printf("asin(1.1) = %f\n", asin(1.1));
    if (errno == EDOM)
        perror("    errno == EDOM");
    if (fetestexcept(FE_INVALID))
        puts("    FE_INVALID raised");
}

Mögliche Ausgabe:

asin( 1.0) = +1.570796, 2*asin( 1.0)=+3.141593
asin(-0.5) = -0.523599, 6*asin(-0.5)=-3.141593
asin(0.0) = 0.000000, asin(-0.0)=-0.000000
asin(1.1) = nan
    errno == EDOM: Numerical argument out of domain
    FE_INVALID raised

Referenzen

  • C23-Standard (ISO/IEC 9899:2024):
  • 7.12.4.2 Die asin-Funktionen (S: TBD)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S: TBD)
  • F.10.1.2 Die asin-Funktionen (S: TBD)
  • C17-Standard (ISO/IEC 9899:2018):
  • 7.12.4.2 Die asin-Funktionen (S: 174)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S: 272-273)
  • F.10.1.2 Die asin-Funktionen (S: 378)
  • C11-Standard (ISO/IEC 9899:2011):
  • 7.12.4.2 Die asin-Funktionen (S: 238)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S: 373-375)
  • F.10.1.2 Die asin-Funktionen (S: 518)
  • C99-Standard (ISO/IEC 9899:1999):
  • 7.12.4.2 Die asin-Funktionen (S. 219)
  • 7.22 Typgenerische Mathematik <tgmath.h> (S. 335-337)
  • F.9.1.2 Die asin-Funktionen (S. 456)
  • C89/C90 Standard (ISO/IEC 9899:1990):
  • 4.5.2.2 Die asin-Funktion

Siehe auch

(C99) (C99)
berechnet Arkuskosinus ( arccos(x) )
(Funktion)
(C99) (C99)
berechnet Arkustangens ( arctan(x) )
(Funktion)
berechnet Arkustangens unter Verwendung von Vorzeichen zur Quadrantenbestimmung
(Funktion)
(C99) (C99)
berechnet Sinus ( sin(x) )
(Funktion)
(C99) (C99) (C99)
berechnet den komplexen Arkussinus
(Funktion)