mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 14:27:27 -08:00
* Add atan2 to scalar operators Signed-off-by: Tomasz Ziolkowski <tomasz.ziolkowski@allegro.pl>
This commit is contained in:
parent
fdbc40a9ef
commit
55f9147b44
|
@ -2085,6 +2085,8 @@ func scalarBinop(op parser.ItemType, lhs, rhs float64) float64 {
|
||||||
return btos(lhs >= rhs)
|
return btos(lhs >= rhs)
|
||||||
case parser.LTE:
|
case parser.LTE:
|
||||||
return btos(lhs <= rhs)
|
return btos(lhs <= rhs)
|
||||||
|
case parser.ATAN2:
|
||||||
|
return math.Atan2(lhs, rhs)
|
||||||
}
|
}
|
||||||
panic(errors.Errorf("operator %q not allowed for Scalar operations", op))
|
panic(errors.Errorf("operator %q not allowed for Scalar operations", op))
|
||||||
}
|
}
|
||||||
|
|
6
promql/testdata/operators.test
vendored
6
promql/testdata/operators.test
vendored
|
@ -481,3 +481,9 @@ eval instant at 5m trigy atan2 trigx
|
||||||
|
|
||||||
eval instant at 5m trigy atan2 trigNaN
|
eval instant at 5m trigy atan2 trigNaN
|
||||||
trigy{} NaN
|
trigy{} NaN
|
||||||
|
|
||||||
|
eval instant at 5m 10 atan2 20
|
||||||
|
0.4636476090008061
|
||||||
|
|
||||||
|
eval instant at 5m 10 atan2 NaN
|
||||||
|
NaN
|
||||||
|
|
Loading…
Reference in a new issue