Add Service Fabric Provider

This commit is contained in:
Lawrence Gripper 2017-11-27 13:26:04 +00:00 committed by Traefiker
parent 9f6f637527
commit 39c1cc1b3c
21 changed files with 1624 additions and 18 deletions

View file

@ -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
}