1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Update dependencies

This commit is contained in:
Andrey Nering
2017-06-04 16:06:04 -03:00
parent f98bf6c4b1
commit 09e6d5269d
130 changed files with 26814 additions and 19205 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
}