Add Service Fabric Provider
This commit is contained in:
parent
9f6f637527
commit
39c1cc1b3c
21 changed files with 1624 additions and 18 deletions
30
vendor/github.com/Masterminds/sprig/numeric.go
generated
vendored
30
vendor/github.com/Masterminds/sprig/numeric.go
generated
vendored
|
@ -127,3 +127,33 @@ func untilStep(start, stop, step int) []int {
|
|||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func floor(a interface{}) float64 {
|
||||
aa := toFloat64(a)
|
||||
return math.Floor(aa)
|
||||
}
|
||||
|
||||
func ceil(a interface{}) float64 {
|
||||
aa := toFloat64(a)
|
||||
return math.Ceil(aa)
|
||||
}
|
||||
|
||||
func round(a interface{}, p int, r_opt ...float64) float64 {
|
||||
roundOn := .5
|
||||
if len(r_opt) > 0 {
|
||||
roundOn = r_opt[0]
|
||||
}
|
||||
val := toFloat64(a)
|
||||
places := toFloat64(p)
|
||||
|
||||
var round float64
|
||||
pow := math.Pow(10, places)
|
||||
digit := pow * val
|
||||
_, div := math.Modf(digit)
|
||||
if div >= roundOn {
|
||||
round = math.Ceil(digit)
|
||||
} else {
|
||||
round = math.Floor(digit)
|
||||
}
|
||||
return round / pow
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue