mirror of
https://github.com/wahyd4/knowledge.git
synced 2026-08-09 05:06:28 +10:00
Add big int for fo
This commit is contained in:
+37
-3
@@ -59,6 +59,40 @@ msg := <-messages
|
||||
```go
|
||||
ch := make(chan Task, 3)
|
||||
```
|
||||
## Big Numbers
|
||||
|
||||
Package big implements arbitrary-precision arithmetic (big numbers).
|
||||
For example the int numbers larger than `int64` or the float greater than `float64`.
|
||||
|
||||
```
|
||||
int16: (-32,768 to +32,767)
|
||||
|
||||
int32: (-2,147,483,648 to +2,147,483,647)
|
||||
|
||||
int64: (-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807)
|
||||
```
|
||||
The following numeric types are supported:
|
||||
```
|
||||
Int signed integers
|
||||
Rat rational numbers
|
||||
Float floating-point numbers
|
||||
```
|
||||
|
||||
Some exmaple code
|
||||
```go
|
||||
import "math/big"
|
||||
|
||||
//string to Int
|
||||
n1 := new(big.Int)
|
||||
n1, ok = n1.SetString(str1, 10)
|
||||
|
||||
// Int1 + Int2
|
||||
result := new(big.Int)
|
||||
result.Add(n1, n2)
|
||||
|
||||
// Int to string
|
||||
result.String()
|
||||
```
|
||||
|
||||
## Sync
|
||||
|
||||
@@ -150,14 +184,14 @@ return p.count
|
||||
// more readable
|
||||
```
|
||||
|
||||
# Frameworks
|
||||
## Frameworks
|
||||
|
||||
## db
|
||||
### db
|
||||
|
||||
- xorm
|
||||
- gorm
|
||||
|
||||
## web
|
||||
### web
|
||||
|
||||
- beego
|
||||
- mux
|
||||
|
||||
Reference in New Issue
Block a user