Trigonometric functions :: Kloudfuse Docs
Trigonometric functions
PromQL supports the standard trigonometric functions for use in mathematical and scientific queries. All angles are in radians; convert with deg() and rad().
acos
Computes the arccosine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
acos(<expr>)
Example
Find the angle whose cosine is 0.5 — the result is 60 degrees.
deg(acos(vector(0.5)))
| Value |
|---|
| 60 |
acosh
Computes the inverse hyperbolic cosine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
acosh(<expr>)
Example
Compute the inverse hyperbolic cosine of 2 — ≈ 1.317.
acosh(vector(2))
| Value |
|---|
| 1.317 |
asin
Computes the arcsine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
asin(<expr>)
Example
Find the angle whose sine is 0.5 — the result is 30 degrees.
deg(asin(vector(0.5)))
| Value |
|---|
| 30 |
asinh
Computes the inverse hyperbolic sine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
asinh(<expr>)
Example
Compute the inverse hyperbolic sine of 1 — ≈ 0.881.
asinh(vector(1))
| Value |
|---|
| 0.8814 |
atan
Computes the arctangent of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
atan(<expr>)
Example
Find the angle whose tangent is 1 — the result is 45 degrees.
deg(atan(vector(1)))
| Value |
|---|
| 45 |
atanh
Computes the inverse hyperbolic tangent of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
atanh(<expr>)
Example
Compute the inverse hyperbolic tangent of 0.5 — ≈ 0.549.
atanh(vector(0.5))
| Value |
|---|
| 0.5493 |
cos
Computes the cosine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
cos(<expr>)
Example
Compute the cosine of 60 degrees — the result is 0.5.
cos(rad(vector(60)))
| Value |
|---|
| 0.5 |
cosh
Computes the hyperbolic cosine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
cosh(<expr>)
Example
Compute the hyperbolic cosine of 1 — ≈ 1.543.
cosh(vector(1))
| Value |
|---|
| 1.543 |
deg
Converts every sample value of the input vector from radians to degrees, preserving all labels.
Syntax
deg(<expr>)
Example
Convert π radians to degrees — the result is 180.
deg(vector(pi()))
| Value |
|---|
| 180 |
pi
Returns π as a scalar. Wrap it in vector() when a vector result is needed, or use it directly as a scalar argument.
Syntax
pi()
Example
Return π as a chartable vector.
vector(pi())
| Value |
|---|
| 3.142 |
rad
Converts every sample value of the input vector from degrees to radians, preserving all labels.
Syntax
rad(<expr>)
Example
Convert 180 degrees to radians — the result is π, ≈ 3.14159.
rad(vector(180))
| Value |
|---|
| 3.142 |
sin
Computes the sine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
sin(<expr>)
Example
Compute the sine of 30 degrees — the result is 0.5.
sin(rad(vector(30)))
| Value |
|---|
| 0.5 |
sinh
Computes the hyperbolic sine of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
sinh(<expr>)
Example
Compute the hyperbolic sine of 1 — ≈ 1.175.
sinh(vector(1))
| Value |
|---|
| 1.175 |
tan
Computes the tangent of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
tan(<expr>)
Example
Compute the tangent of 45 degrees — the result is 1.
tan(rad(vector(45)))
| Value |
|---|
| 1 |
tanh
Computes the hyperbolic tangent of every sample value of the input vector, preserving all labels. Angles are in radians; convert with rad() and deg().
Syntax
tanh(<expr>)
Example
Compute the hyperbolic tangent of 1 — ≈ 0.762.
tanh(vector(1))
| Value |
|---|
| 0.7616 |