CKTIS / C
cosh — wiskundige C23-functie
`cosh(x)` uit `<math.h>` retourneert de hyperbolische cosinus van `x`, wiskundig `(e^x + e^-x) / 2`. De functie is even; C23 vereist een bereikfout als de grootte van eindige `x` te groot is.
Versie: C23
Syntax
double cosh(double x);cosh(x) uit <math.h> retourneert de hyperbolische cosinus van x, wiskundig (e^x + e^-x) / 2. De functie is even; C23 vereist een bereikfout als de grootte van eindige x te groot is.
Het voorbeeld roept cosh(0.0) en cosh(1.0) aan. 1.000 1.543 toont het minimum bij nul en de afgeronde waarde rond 1,543 bij één.
Gebruik cosh in plaats van twee handmatig samengestelde exp-aanroepen, die numeriek slechter kunnen zijn. Behandel overflow volgens math_errhandling; cosh(±0) = 1 en cosh(±∞) = +∞ zijn Annex F/IEC 60559-details.
Voorbeelden
#include <math.h>
#include <stdio.h>
int main(void) {
printf("%.3f %.3f\n", cosh(0.0), cosh(1.0));
return 0;
}
Resultaat
1.000 1.543
Het voorbeeld roept `cosh(0.0)` en `cosh(1.0)` aan. `1.000 1.543` toont het minimum bij nul en de afgeronde waarde rond 1,543 bij één.