cosh, coshf, coshl
Von cppreference.com
| Definiert in Header <math.h> |
||
| float coshf( float arg ); |
(1) | (seit C99) |
| double cosh( double arg ); |
(2) | |
| long double coshl( long double arg ); |
(3) | (seit C99) |
| Definiert in Header <tgmath.h> |
||
| #define cosh( arg ) |
(4) | (seit C99) |
1-3) Berechnet den hyperbolischen Kosinus von
arg.4) Typ-generische Makro: Wenn das Argument den Typ long double hat, wird
coshl aufgerufen. Andernfalls, wenn das Argument den Ganzzahltyp oder den Typ double hat, wird cosh aufgerufen. Andernfalls wird coshf aufgerufen. Wenn das Argument komplex ist, ruft das Makro die entsprechende komplexe Funktion auf (ccoshf, ccosh, ccoshl).Inhalt |
[edit] Parameter
| arg | - | Gleitkommazahl, die einen hyperbolischen Winkel darstellt |
[edit] Rückgabewert
Wenn keine Fehler auftreten, wird der hyperbolische Kosinus vonarg (cosh(arg) oder | earg +e-arg |
| 2 |
Wenn ein Bereichsfehler aufgrund von Überlauf auftritt, wird +HUGE_VAL, +HUGE_VALF oder +HUGE_VALL zurückgegeben.
[edit] Fehlerbehandlung
Fehler werden wie in math_errhandling angegeben gemeldet.
Wenn die Implementierung IEEE-Gleitkomma-Arithmetik (IEC 60559) unterstützt,
- wenn das Argument ±0 ist, wird 1 zurückgegeben
- Wenn das Argument ±∞ ist, wird +∞ zurückgegeben
- wenn das Argument NaN ist, wird NaN zurückgegeben
[edit] Hinweise
Für den IEEE-kompatiblen Typ double, wenn |arg| > 710,5, dann überläuft cosh(arg).
[edit] Beispiel
Führen Sie diesen Code aus
#include <errno.h> #include <fenv.h> #include <math.h> #include <stdio.h> // #pragma STDC FENV_ACCESS ON int main(void) { printf("cosh(1) = %f\ncosh(-1)= %f\n", cosh(1), cosh(-1)); printf("log(sinh(1) + cosh(1))=%f\n", log(sinh(1) + cosh(1))); // special values printf("cosh(+0) = %f\ncosh(-0) = %f\n", cosh(0.0), cosh(-0.0)); // error handling errno = 0; feclearexcept(FE_ALL_EXCEPT); printf("cosh(710.5) = %f\n", cosh(710.5)); if (errno == ERANGE) perror(" errno == ERANGE"); if (fetestexcept(FE_OVERFLOW)) puts(" FE_OVERFLOW raised"); }
Mögliche Ausgabe
cosh(1) = 1.543081
cosh(-1)= 1.543081
log(sinh(1) + cosh(1))=1.000000
cosh(+0) = 1.000000
cosh(-0) = 1.000000
cosh(710.5) = inf
errno == ERANGE: Numerical result out of range
FE_OVERFLOW raised[edit] Referenzen
- C23-Standard (ISO/IEC 9899:2024)
- 7.12.5.4 Die cosh-Funktionen (S. TBD)
- 7.25 Typ-generische Mathematik <tgmath.h> (S. TBD)
- F.10.2.4 Die cosh-Funktionen (S. TBD)
- C17-Standard (ISO/IEC 9899:2018)
- 7.12.5.4 Die cosh-Funktionen (S. 176)
- 7.25 Typ-generische Mathematik <tgmath.h> (S. 272-273)
- F.10.2.4 Die cosh-Funktionen (S. 379)
- C11-Standard (ISO/IEC 9899:2011)
- 7.12.5.4 Die cosh-Funktionen (S. 241)
- 7.25 Typ-generische Mathematik <tgmath.h> (S. 373-375)
- F.10.2.4 Die cosh-Funktionen (S. 520)
- C99-Standard (ISO/IEC 9899:1999)
- 7.12.5.4 Die cosh-Funktionen (S. 222)
- 7.22 Typ-generische Mathematik <tgmath.h> (S. 335-337)
- F.9.2.4 Die cosh-Funktionen (S. 457)
- C89/C90-Standard (ISO/IEC 9899:1990)
- 4.5.3.1 Die cosh-Funktion
[edit] Siehe auch
| (C99)(C99) |
berechnet Sinus hyperbolicus (sinh(x)) (Funktion) |
| (C99)(C99) |
berechnet Tangens hyperbolicus (tanh(x)) (Funktion) |
| (C99)(C99)(C99) |
berechnet inversen Kosinus hyperbolicus (arcosh(x)) (Funktion) |
| (C99)(C99)(C99) |
berechnet den komplexen hyperbolischen Kosinus (Funktion) |
| C++ Dokumentation für cosh
| |