mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 02:47:48 +08:00
10 lines
189 B
Go
10 lines
189 B
Go
package testutils
|
|
|
|
func FloatTruncate(value float64, decimalPlaces int) float64 {
|
|
pow := 1.0
|
|
for i := 0; i < decimalPlaces; i++ {
|
|
pow *= 10.0
|
|
}
|
|
return float64(int(value*pow)) / pow
|
|
}
|