Trigonometric functions use radians unless the function name says otherwise.
Returns the arc cosine of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. Must be between `-1` and `1`. |
Returns: angle in radians.
Example:
rad2deg(acos(0)); // 90
Returns the inverse hyperbolic cosine of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. Must be greater than or equal to `1`. |
Returns: number.
Example:
acosh(1); // 0
Returns the arc sine of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. Must be between `-1` and `1`. |
Returns: angle in radians.
Example:
rad2deg(asin(1)); // 90
Returns the inverse hyperbolic sine of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. |
Returns: number.
Example:
asinh(0); // 0
Returns the arc tangent of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. |
Returns: angle in radians.
Example:
rad2deg(atan(1)); // 45
Returns the arc tangent using `y` and `x`.
| Argument | Type | Description |
|---|---|---|
| `y` | number | Y component. |
| `x` | number | X component. |
Returns: angle in radians.
The pair `0, 0` is undefined and raises an error.
Example:
rad2deg(atan2(1, 0)); // 90
Returns the inverse hyperbolic tangent of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. Must be between `-1` and `1`. |
Returns: number.
Example:
atanh(0); // 0
Returns the cosine of angle `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Angle in radians. |
Returns: number.
Example:
cos(0); // 1
Returns the hyperbolic cosine of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. |
Returns: number.
Example:
cosh(0); // 1
Returns the cotangent of angle `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Angle in radians. |
Returns: number.
Example:
cot(deg2rad(45));
Returns the cosecant of angle `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Angle in radians. |
Returns: number.
Example:
csc(deg2rad(90));
Converts degrees to radians.
| Argument | Type | Description |
|---|---|---|
| `degrees` | number | Angle in degrees. |
Returns: angle in radians.
Example:
deg2rad(180); // pi radians
Returns the length of a 2D vector.
| Argument | Type | Description |
|---|---|---|
| `x` | number | X component. |
| `y` | number | Y component. |
Returns: number.
Example:
hypot(3, 4); // 5
Returns the pi constant.
| Argument | Type | Description |
|---|---|---|
| none | No arguments. |
Returns: number.
Example:
rad2deg(pi()); // 180
Converts radians to degrees.
| Argument | Type | Description |
|---|---|---|
| `radians` | number | Angle in radians. |
Returns: angle in degrees.
Example:
rad2deg(pi()); // 180
Returns the secant of angle `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Angle in radians. |
Returns: number.
Example:
sec(0); // 1
Returns the sine of angle `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Angle in radians. |
Returns: number.
Example:
sin(deg2rad(90)); // 1
Returns the hyperbolic sine of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. |
Returns: number.
Example:
sinh(0); // 0
Returns the tangent of angle `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Angle in radians. |
Returns: number.
Example:
tan(deg2rad(45)); // 1
Returns the hyperbolic tangent of `x`.
| Argument | Type | Description |
|---|---|---|
| `x` | number | Input value. |
Returns: number.
Example:
tanh(0); // 0
Previous: Logarithmic and Exponential
Next: Rounding and Centering