cosh, coshf, coshl
From cppreference.net
Common mathematical functions
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definido en el encabezado
<math.h>
|
||
|
float
coshf
(
float
arg
)
;
|
(1) | (desde C99) |
|
double
cosh
(
double
arg
)
;
|
(2) | |
|
long
double
coshl
(
long
double
arg
)
;
|
(3) | (desde C99) |
|
Definido en el encabezado
<tgmath.h>
|
||
|
#define cosh( arg )
|
(4) | (desde C99) |
1-3)
Calcula el coseno hiperbólico de
arg
.
4)
Macro genérico de tipos: Si el argumento tiene tipo
long
double
,
coshl
es llamado. De lo contrario, si el argumento tiene tipo entero o el tipo
double
,
cosh
es llamado. De lo contrario,
coshf
es llamado. Si el argumento es complejo, entonces el macro invoca la función compleja correspondiente (
ccoshf
,
ccosh
,
ccoshl
).
Contenidos |
Parámetros
| arg | - | valor de punto flotante que representa un ángulo hiperbólico |
Valor de retorno
If no errors occur, the hyperbolic cosine of
arg
(
cosh(arg)
, or
|
e
arg
+e -arg |
| 2 |
Si ocurre un error de rango debido a desbordamiento,
+HUGE_VAL
,
+HUGE_VALF
, o
+HUGE_VALL
es devuelto.
Manejo de errores
Los errores se reportan como se especifica en
math_errhandling
.
Si la implementación soporta aritmética de punto flotante IEEE (IEC 60559),
- si el argumento es ±0, se devuelve 1
- si el argumento es ±∞, se devuelve +∞
- si el argumento es NaN, se devuelve NaN
Notas
Para el tipo compatible con IEEE
double
, si
|arg| > 710.5
, entonces
cosh(arg)
produce desbordamiento.
Ejemplo
Ejecutar este código
#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"); }
Salida posible:
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
Referencias
- Estándar C23 (ISO/IEC 9899:2024):
-
- 7.12.5.4 Las funciones cosh (p: TBD)
-
- 7.25 Matemáticas genéricas de tipos <tgmath.h> (p: TBD)
-
- F.10.2.4 Las funciones cosh (p: TBD)
- Estándar C17 (ISO/IEC 9899:2018):
-
- 7.12.5.4 Las funciones cosh (p: 176)
-
- 7.25 Matemáticas genéricas de tipos <tgmath.h> (p: 272-273)
-
- F.10.2.4 Las funciones cosh (p: 379)
- Estándar C11 (ISO/IEC 9899:2011):
-
- 7.12.5.4 Las funciones cosh (p: 241)
-
- 7.25 Matemáticas genéricas de tipos <tgmath.h> (p: 373-375)
-
- F.10.2.4 Las funciones cosh (p: 520)
- Estándar C99 (ISO/IEC 9899:1999):
-
- 7.12.5.4 Las funciones cosh (p: 222)
-
- 7.22 Matemáticas genéricas de tipo <tgmath.h> (p: 335-337)
-
- F.9.2.4 Las funciones cosh (p: 457)
- Estándar C89/C90 (ISO/IEC 9899:1990):
-
- 4.5.3.1 La función cosh
Véase también
|
(C99)
(C99)
|
calcula el seno hiperbólico (
\({\small\sinh{x} }\)
sinh(x)
)
(función) |
|
(C99)
(C99)
|
calcula la tangente hiperbólica (
\({\small\tanh{x} }\)
tanh(x)
)
(función) |
|
(C99)
(C99)
(C99)
|
calcula el coseno hiperbólico inverso (
\({\small\operatorname{arcosh}{x} }\)
arcosh(x)
)
(función) |
|
(C99)
(C99)
(C99)
|
calcula el coseno hiperbólico complejo
(función) |
|
Documentación de C++
para
cosh
|
|