allow 'zero y-range delta' (#72)

This commit is contained in:
Edwin 2018-04-16 03:35:39 +08:00 committed by Will Charczuk
parent 7c3982fe3d
commit 2dc8482db3
4 changed files with 8 additions and 22 deletions

View file

@ -93,12 +93,18 @@ func (m mathUtil) GetRoundToForDelta(delta float64) float64 {
// RoundUp rounds up to a given roundTo value.
func (m mathUtil) RoundUp(value, roundTo float64) float64 {
if roundTo < 0.000000000000001 {
return value
}
d1 := math.Ceil(value / roundTo)
return d1 * roundTo
}
// RoundDown rounds down to a given roundTo value.
func (m mathUtil) RoundDown(value, roundTo float64) float64 {
if roundTo < 0.000000000000001 {
return value
}
d1 := math.Floor(value / roundTo)
return d1 * roundTo
}