-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
46 lines (38 loc) · 1.04 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
----------------------------------------------
File Name: main_test.go
Author: jw199@firecloud.ai
@Company: Firecloud
Created Time: 2023/3/31 17:56
-------------------功能说明-------------------
$
----------------------------------------------
*/
package main
import (
"fmt"
"math"
"math/big"
"testing"
)
func Test1(t *testing.T) {
balance := big.NewInt(19999999999)
//balance := big.NewInt(120000000000)
fmt.Println(new(big.Int).Div(balance, big.NewInt(120000000000)).Int64())
a := new(big.Int).Mul(balance, big.NewInt(9))
b := new(big.Int).Div(a, big.NewInt(10))
fmt.Println(a)
fmt.Println(b)
}
func Test2(t *testing.T) {
balance, _ := new(big.Int).SetString("120000000000", 10)
b1 := new(big.Float)
b1.SetString(balance.String())
ethValue := new(big.Float).Quo(b1, big.NewFloat(math.Pow(10, 18)))
fmt.Println(ethValue)
}
func Test3(t *testing.T) {
a := new(big.Int).Mul(big.NewInt(1000000000000000000), big.NewInt(8))
b := new(big.Int).Mul(big.NewInt(1000000000000000001), big.NewInt(8))
fmt.Println(new(big.Int).Div(a, b))
}