## What is cosh in c programming?

cosh in c is a mathematical function which is used to calculate hyperbolic cosine of a given number.

This function is defined in math.h header file.

### Prototype

`double cosh(double y);`

### Parameters

cosh function takes floating point value as input parameter.

### Return value

cosh function returns hyperbolic cosine value of a given number.

## Example program for cosh in c

```
#include<stdio.h>
#include<math.h>
int main()
{
double m=0.8,res;
res=cosh(m);
printf("\n\n\tHyperbolic cosine value is %lf \n",res);
return 0;
}
```

While using gcc use below command to add math header.

`gcc file_name.c -lm`

### Code explanation

The hyperbolic cosine value of a given number is found by calling cosh function and the result is printed onto the console.

## Difference between cosh and cos in c

cosh in c is used to find the hyperbolic cosine of a given number. cos in c is a mathematical function that is used to find cosine of a given number.

Prototypes are as follows

```
double cosh(double y);
double cos(double y);
```

cosh( ) | cos( ) |

Used to find hyperbolic cosine of given number. | Used to find cosine of given number. |

`double cosh(double y);` | `double cos(double y);` |

## Difference between cosh and sinh in c

cosh in c is used to find hyperbolic cosine of given number. sinh in c is used to find hyperbolic sine of given number.

Prototypes are as follows

```
double cosh(double y);
double sinh(double y);
```

cosh( ) | sinh( ) |

Used to find hyperbolic cosine of given number. | Used to find hyperbolic sine of given number. |

`double cosh(double y);` | `double sinh(double y);` |

## Difference between cosh and tanh in c

cosh in c is used to find the hyperbolic cosine of a given number. tanh in c is used to find the hyperbolic tangent of a given number.

Prototypes are as follows

```
double cosh(double y);
double tanh(double y);
```

cosh | tanh |

Used to find hyperbolic cosine of given number. | Used to find hyperbolic tangent of given number. |

`double cosh(double y);` | `double tanh(double y);` |

## People also ask for

### What is cosh in c?

cosh in c is a mathematical function that is used to calculate the hyperbolic cosine of a given number.

### What error can be expected if cosh fails?

If cosh fails then error will be range error.