mirror of
https://github.com/nikdoof/vsphere-influxdb-go.git
synced 2025-12-19 05:29:21 +00:00
add vendoring with go dep
This commit is contained in:
21
vendor/github.com/influxdata/influxdb/influxql/linear.go
generated
vendored
Normal file
21
vendor/github.com/influxdata/influxdb/influxql/linear.go
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package influxql
|
||||
|
||||
// linearFloat computes the the slope of the line between the points (previousTime, previousValue) and (nextTime, nextValue)
|
||||
// and returns the value of the point on the line with time windowTime
|
||||
// y = mx + b
|
||||
func linearFloat(windowTime, previousTime, nextTime int64, previousValue, nextValue float64) float64 {
|
||||
m := (nextValue - previousValue) / float64(nextTime-previousTime) // the slope of the line
|
||||
x := float64(windowTime - previousTime) // how far into the interval we are
|
||||
b := previousValue
|
||||
return m*x + b
|
||||
}
|
||||
|
||||
// linearInteger computes the the slope of the line between the points (previousTime, previousValue) and (nextTime, nextValue)
|
||||
// and returns the value of the point on the line with time windowTime
|
||||
// y = mx + b
|
||||
func linearInteger(windowTime, previousTime, nextTime int64, previousValue, nextValue int64) int64 {
|
||||
m := float64(nextValue-previousValue) / float64(nextTime-previousTime) // the slope of the line
|
||||
x := float64(windowTime - previousTime) // how far into the interval we are
|
||||
b := float64(previousValue)
|
||||
return int64(m*x + b)
|
||||
}
|
||||
Reference in New Issue
Block a user