master
go 9 lines 178 Bytes
Raw
1 package testutils
2
3 func FloatTruncate(value float64, decimalPlaces int) float64 {
4 pow := 1.0
5 for range decimalPlaces {
6 pow *= 10.0
7 }
8 return float64(int(value*pow)) / pow
9 }