acos, acosf, acosl
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definiert in Header
<math.h>
|
||
|
float
acosf
(
float
arg
)
;
|
(1) | (seit C99) |
|
double
acos
(
double
arg
)
;
|
(2) | |
|
long
double
acosl
(
long
double
arg
)
;
|
(3) | (seit C99) |
|
_Decimal32 acosd32
(
_Decimal32 arg
)
;
|
(4) | (seit C23) |
|
_Decimal64 acosd64
(
_Decimal64 arg
)
;
|
(5) | (seit C23) |
|
_Decimal128 acosd128
(
_Decimal128 arg
)
;
|
(6) | (seit C23) |
|
Definiert in Header
<tgmath.h>
|
||
|
#define acos( arg )
|
(7) | (seit C99) |
acosl
) wird aufgerufen. Andernfalls, wenn das Argument einen Ganzzahltyp oder den Typ
double
hat,
(2)
(
acos
) wird aufgerufen. Andernfalls
(1)
(
acosf
) wird aufgerufen. Wenn das Argument komplex ist, ruft das Makro die entsprechende komplexe Funktion auf (
cacosf
,
cacos
,
cacosl
).
|
Die Funktionen
(4-6)
werden genau dann deklariert, wenn die Implementierung
|
(seit C23) |
Inhaltsverzeichnis |
Parameter
| arg | - | Gleitkommawert |
Rückgabewert
Wenn keine Fehler auftreten, wird der Arkuskosinus von arg ( arccos(arg) ) im Bereich [0 ; π] zurückgegeben.
Wenn ein Domänenfehler auftritt, wird ein implementierungsdefinierter Wert zurückgegeben (NaN, sofern 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
spezifiziert.
Domain-Fehler 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
+1
ist, wird der Wert
+0zurückgegeben; - Wenn |arg| > 1 ist, 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("acos(-1) = %f\n", acos(-1)); printf("acos(0.0) = %f 2*acos(0.0) = %f\n", acos(0), 2 * acos(0)); printf("acos(0.5) = %f 3*acos(0.5) = %f\n", acos(0.5), 3 * acos(0.5)); printf("acos(1) = %f\n", acos(1)); // Fehlerbehandlung errno = 0; feclearexcept(FE_ALL_EXCEPT); printf("acos(1.1) = %f\n", acos(1.1)); if (errno == EDOM) perror(" errno == EDOM"); if (fetestexcept(FE_INVALID)) puts(" FE_INVALID raised"); }
Mögliche Ausgabe:
acos(-1) = 3.141593
acos(0.0) = 1.570796 2*acos(0.0) = 3.141593
acos(0.5) = 1.047198 3*acos(0.5) = 3.141593
acos(1) = 0.000000
acos(1.1) = nan
errno == EDOM: Numerical argument out of domain
FE_INVALID raised
Referenzen
- C23-Standard (ISO/IEC 9899:2024):
-
- 7.12.4.1 Die acos-Funktionen (S.: TBD)
-
- 7.25 Typgenerische Mathematik <tgmath.h> (S.: TBD)
-
- F.10.1.1 Die acos-Funktionen (S.: TBD)
- C17-Standard (ISO/IEC 9899:2018):
-
- 7.12.4.1 Die acos-Funktionen (S. 173)
-
- 7.25 Typgenerische Mathematik <tgmath.h> (S. 272-273)
-
- F.10.1.1 Die acos-Funktionen (S. 378)
- C11-Standard (ISO/IEC 9899:2011):
-
- 7.12.4.1 Die acos-Funktionen (S: 238)
-
- 7.25 Typgenerische Mathematik <tgmath.h> (S: 373-375)
-
- F.10.1.1 Die acos-Funktionen (S: 518)
- C99-Standard (ISO/IEC 9899:1999):
-
- 7.12.4.1 Die acos-Funktionen (S. 218)
-
- 7.22 Typgenerische Mathematik <tgmath.h> (S. 335-337)
-
- F.9.1.1 Die acos-Funktionen (S. 455)
- C89/C90 Standard (ISO/IEC 9899:1990):
-
- 4.5.2.1 Die acos-Funktion
Siehe auch
|
(C99)
(C99)
|
berechnet den Arkussinus (
\({\small\arcsin{x} }\)
arcsin(x)
)
(Funktion) |
|
(C99)
(C99)
|
berechnet den Arkustangens (
\({\small\arctan{x} }\)
arctan(x)
)
(Funktion) |
|
(C99)
(C99)
|
berechnet den Arkustangens unter Verwendung von Vorzeichen zur Quadrantenbestimmung
(Funktion) |
|
(C99)
(C99)
|
berechnet den Kosinus (
\({\small\cos{x} }\)
cos(x)
)
(Funktion) |
|
(C99)
(C99)
(C99)
|
berechnet den komplexen Arkuskosinus
(Funktion) |
|
C++-Dokumentation
für
acos
|
|