This repository has been archived on 2024-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
stick/twig/filter/round_pre1.10.go
2021-09-17 21:53:19 -06:00

17 lines
205 B
Go

//go:build !go1.10
// +build !go1.10
package filter
import (
"math"
)
func mathRound(x float64) float64 {
t := math.Trunc(x)
if math.Abs(x-t) >= 0.5 {
return t + math.Copysign(1, x)
}
return t
}