commit
9f96ffb669
@ -0,0 +1,17 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: clone
|
||||
|
||||
steps:
|
||||
- name: Test
|
||||
image: golang:1.18
|
||||
commands:
|
||||
- go env -w GO111MODULE=on
|
||||
- go env -w GOPROXY=https://goproxy.cn,direct
|
||||
- go test -v ./...
|
||||
- name: Benchmark
|
||||
image: golang:1.18
|
||||
commands:
|
||||
- go env -w GO111MODULE=on
|
||||
- go env -w GOPROXY=https://goproxy.cn,direct
|
||||
- go test -bench=. -benchmem
|
@ -0,0 +1,9 @@
|
||||
.env
|
||||
.git
|
||||
.svn
|
||||
.idea
|
||||
.vscode
|
||||
*.log
|
||||
goinit.sh
|
||||
gomod.sh
|
||||
/vendor/
|
@ -0,0 +1,13 @@
|
||||
package gofloat
|
||||
|
||||
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)
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
package gofloat
|
||||
|
||||
const Version = "1.0.0"
|
@ -0,0 +1,7 @@
|
||||
package gofloat
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
t.Log(Version)
|
||||
}
|
Loading…
Reference in new issue