parent
f9b3b9b223
commit
9225a59fda
@ -0,0 +1,14 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.17.x
|
||||
- tip
|
||||
|
||||
before_install:
|
||||
- go get -t -v ./...
|
||||
|
||||
script:
|
||||
- go test -race -coverprofile=coverage.txt -covermode=atomic
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
@ -0,0 +1,13 @@
|
||||
package float
|
||||
|
||||
import "math"
|
||||
|
||||
// ToInt64 将float64转成精确的int64
|
||||
func ToInt64(num float64, retain int) int64 {
|
||||
return int64(num * math.Pow10(retain))
|
||||
}
|
||||
|
||||
// ToFloat64 精准float64
|
||||
func ToFloat64(num float64, retain int) float64 {
|
||||
return num * math.Pow10(retain)
|
||||
}
|
Loading…
Reference in new issue