10 lines
186 B
Go
10 lines
186 B
Go
|
package utils
|
||
|
|
||
|
import "math"
|
||
|
|
||
|
// RoundFloat rounds f to precision p
|
||
|
func RoundFloat(f float64, p uint) float64 {
|
||
|
ratio := math.Pow(10, float64(p))
|
||
|
return math.Round(f*ratio) / ratio
|
||
|
}
|