fsub
Input Stack:
|
⇨ | Output Stack:
|
Floating point subtraction operator that follows strict IEEE 754 floating point arithmetic.
Compute a new time series where each interval has the value (ts1 - ts2)
where values
are the corresponding intervals in the input time series.
Parameters¶
- ts1: First time series expression (left operand, minuend)
- ts2: Second time series expression (right operand, subtrahend)
NaN Handling¶
Unlike :sub, this operator follows standard floating point rules where any operation involving NaN produces NaN as the result:
:fsub | 1.0 | 0.0 | 1.0 | NaN | NaN |
---|---|---|---|---|---|
Input 1 | 2.0 | 0.0 | 1.0 | 1.0 | NaN |
Input 2 | 1.0 | 0.0 | 0.0 | NaN | NaN |
Warning
This can lead to confusing behavior when combining time series with missing data. If a time series has NaN values (e.g., from a node that started reporting mid-window), the result will be NaN. Use :sub instead to treat NaN values as zero.
Examples¶
Subtracting a constant value:
Before | After |
name,sps,:eq | name,sps,:eq, 30000,:fsub |
Subtracting two time series:
Before | After |
name,requestLatency,:eq, :sum, name,requestsPerSecond,:eq, :max, (,name,),:by | name,requestLatency,:eq, :sum, name,requestsPerSecond,:eq, :max, (,name,),:by, :fsub |