You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
273 B
14 lines
273 B
2 years ago
|
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)
|
||
|
}
|