Trigonometric operators :: Kloudfuse Docs
Trigonometric operators
FuseQL supports the following trigonometric functions for use in mathematical and scientific queries.
acos
Returns the arccosine (inverse cosine) of a number, in radians. The input must be in the range [-1, 1]. Use acos to recover an angle from a precomputed cosine value — for example, when computing angular separation between directions stored in log data.
Syntax
| acos(<number>) as <alias>
Parameters
| Parameter | Required | Description |
|---|---|---|
<number> |
Required | A numeric field name or literal in the range [-1, 1]. Values outside this range return NaN. |
as <alias> |
Required | Output column name for the result, in radians. |
Example
Compute the arccosine of a fixed value to verify the trigonometric identity: acos(0.5) is π/3 radians (60°).
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| acos(0.5) as angle_rad
| _timeslice | angle_rad |
|---|---|
| 2026-06-27 18:00:00 UTC | 1.0472 |
| 2026-06-27 19:00:00 UTC | 1.0472 |
Expected output
acos(0.5) returns 1.0472 radians (π/3, or 60°). acos(1.0) returns 0; acos(-1.0) returns 3.1416 (π). To convert radians to degrees, multiply by 180 / 3.14159. All trigonometric operators in FuseQL work in radians. |
asin
Returns the arcsine (inverse sine) of a number, in radians. The input must be in the range [-1, 1]. Use asin to recover an angle from a precomputed sine value — for example, when processing normalized coordinates or bearing data stored in structured logs.
Syntax
| asin(<number>) as <alias>
Parameters
Example
Compute the arcsine of 0.5 to illustrate the result: asin(0.5) is π/6 radians (30°).
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| asin(0.5) as angle_rad
| _timeslice | angle_rad |
|---|---|
| 2026-06-27 18:00:00 UTC | 0.5236 |
| 2026-06-27 19:00:00 UTC | 0.5236 |
Expected output
asin(0.5) returns 0.5236 radians (π/6, or 30°). asin(0) returns 0; asin(1) returns 1.5708 (π/2, or 90°). To convert radians to degrees, multiply by 180 / 3.14159. All trigonometric operators in FuseQL work in radians. |
atan
Returns the arctangent (inverse tangent) of a number, in radians. The result is always in the range (-π/2, π/2). Unlike asin and acos, atan accepts any real-valued input. Use atan to recover an angle from a slope or ratio stored in log data.
Syntax
| atan(<number>) as <alias>
Parameters
| Parameter | Required | Description |
|---|---|---|
<number> |
Required | A numeric field name or literal value. Accepts any real number; no domain restriction. |
as <alias> |
Required | Output column name for the result, in radians. |
Example
Compute the arctangent of 1.0 — which is π/4 radians (45°) — to illustrate the result.
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| atan(1.0) as angle_rad
| _timeslice | angle_rad |
|---|---|
| 2026-06-27 18:00:00 UTC | 0.7854 |
| 2026-06-27 19:00:00 UTC | 0.7854 |
Expected output
atan(1.0) returns 0.7854 radians (π/4, or 45°). atan(0) returns 0; atan of a very large positive number approaches π/2 (~1.5708). To convert radians to degrees, multiply by 180 / 3.14159. |
cos
Returns the cosine of a number given in radians. The result is always in the range [-1, 1]. Use cos when transforming polar or angular coordinates stored in log fields into Cartesian components for distance or similarity calculations.
Syntax
| cos(<number>) as <alias>
Parameters
| Parameter | Required | Description |
|---|---|---|
<number> |
Required | A numeric field name or literal value, interpreted as radians. |
as <alias> |
Required | Output column name for the result. |
Example
Compute cos(0) — which equals 1.0 — and cos(3.14159) — which equals approximately -1.0 — to illustrate the function range.
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| cos(0) as cos_0, cos(3.14159) as cos_pi
| _timeslice | cos_0 | cos_pi |
|---|---|---|
| 2026-06-27 18:00:00 UTC | 1.0 | -1.0 |
| 2026-06-27 19:00:00 UTC | 1.0 | -1.0 |
Expected output
cos(0) returns 1.0. The existing partial incorrectly stated the example result was 2.71828 (Euler’s number); the correct value for cos(0) is 1.0. To convert degrees to radians before passing to cos, multiply by 3.14159 / 180. |
cosh
Returns the hyperbolic cosine of a number. cosh(x) is defined as (e^x + e^(-x)) / 2 and is always ≥ 1. Use cosh in signal-processing or physics-based computations applied to log-derived numeric fields.
Syntax
| cosh(<number>) as <alias>
Parameters
| Parameter | Required | Description |
|---|---|---|
<number> |
Required | A numeric field name or literal value. |
as <alias> |
Required | Output column name for the result. |
Example
Compute cosh(0) — which equals 1.0 — to confirm the identity.
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| cosh(0) as cosh_0
| _timeslice | cosh_0 |
|---|---|
| 2026-06-27 18:00:00 UTC | 1.0 |
| 2026-06-27 19:00:00 UTC | 1.0 |
Expected output
cosh(0) returns 1.0. Unlike cos, cosh is not bounded above — cosh(10) is approximately 11013.2. For the inverse function, there is no built-in acosh; use the identity log(x + sqrt(x*x - 1)) if needed. |
sin
Returns the sine of a number given in radians. The result is always in the range [-1, 1]. Use sin when transforming polar or angular log fields into vertical Cartesian components.
Syntax
| sin(<number>) as <alias>
Parameters
Example
Compute sin(0) — which equals 0.0 — and sin(1.5708) — which equals approximately 1.0 (sin of π/2) — to illustrate the function range.
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| sin(0) as sin_0, sin(1.5708) as sin_halfpi
| _timeslice | sin_0 | sin_halfpi |
|---|---|---|
| 2026-06-27 18:00:00 UTC | 0.0 | 1.0 |
| 2026-06-27 19:00:00 UTC | 0.0 | 1.0 |
Expected output
sin(0) returns 0.0. sin(3.14159) returns approximately 0 (floating-point rounding may give a very small non-zero value). To convert degrees to radians before passing to sin, multiply by 3.14159 / 180. |
sinh
Returns the hyperbolic sine of a number. sinh(x) is defined as (e^x − e^(-x)) / 2. The result can be any real number and grows rapidly for large inputs. Use sinh in physics or signal-processing computations applied to numeric fields extracted from logs.
Syntax
| sinh(<number>) as <alias>
Parameters
Example
Compute sinh(0) — which equals 0.0 — to confirm the identity.
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| sinh(0) as sinh_0
| _timeslice | sinh_0 |
|---|---|
| 2026-06-27 18:00:00 UTC | 0.0 |
| 2026-06-27 19:00:00 UTC | 0.0 |
Expected output
sinh(0) returns 0.0. sinh(1) returns approximately 1.1752. Unlike sin, sinh is not bounded — it grows exponentially for large inputs. Applying sinh directly to raw count fields (which may be hundreds of thousands) will overflow; normalize first. |
tan
Returns the tangent of a number given in radians. The result is undefined at multiples of π/2 (where the function diverges to ±infinity). Use tan when computing slopes or bearing angles derived from log-recorded direction fields.
Syntax
| tan(<number>) as <alias>
Parameters
| Parameter | Required | Description |
|---|---|---|
<number> |
Required | A numeric field name or literal value, interpreted as radians. Avoid values at or very near π/2 multiples. |
as <alias> |
Required | Output column name for the result. |
Example
Compute tan(0) — which equals 0.0 — and tan(0.7854) — which equals approximately 1.0 (tangent of π/4 or 45°).
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| tan(0) as tan_0, tan(0.7854) as tan_45deg
| _timeslice | tan_0 | tan_45deg |
|---|---|---|
| 2026-06-27 18:00:00 UTC | 0.0 | 1.0 |
| 2026-06-27 19:00:00 UTC | 0.0 | 1.0 |
Expected output
tan(0) returns 0.0. tan(0.7854) returns 1.0 (π/4 radians = 45°). The function becomes very large near π/2 (~1.5708 radians); avoid passing values close to π/2 as they will produce extremely large or undefined results. |
tanh
Returns the hyperbolic tangent of a number. tanh(x) is defined as sinh(x) / cosh(x) and always returns a value in the range (-1, 1). Use tanh as a smooth sigmoidal squashing function to normalize unbounded metric fields into a bounded range without hard clipping.
Syntax
| tanh(<number>) as <alias>
Parameters
| Parameter | Required | Description |
|---|---|---|
<number> |
Required | A numeric field name or literal value. |
as <alias> |
Required | Output column name for the result. Always in the range (-1, 1). |
Example
Compute tanh(0) — which equals 0.0 — to confirm the identity.
source="nginx"
| timeslice 1h
| count as requests by _timeslice
| tanh(0) as tanh_0
| _timeslice | tanh_0 |
|---|---|
| 2026-06-27 18:00:00 UTC | 0.0 |
| 2026-06-27 19:00:00 UTC | 0.0 |
Expected output
tanh(0) returns 0.0. tanh(1) returns approximately 0.7616. For large positive inputs, tanh saturates near 1.0; for large negative inputs, near -1.0. This makes it a useful bounded alternative to raw count fields when feeding values into comparative expressions. |