bignumber

package module
v0.0.0-...-9e930fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 1 Imported by: 0

README

bigNumber

Golang big number. You can use this repository handle big number.

Use

Decimal to Binary

    import (
        bigNumber "github.com/LiMoMoMo/bigNumber"
        "fmt"
    )
    number, err := bigNumber.New(bigNumber.DECIMAL, "123412341234")
    fmt.Println(number.BinaryStr(), number.DecimalStr())

Binary to Decimal

    import (
        bigNumber "github.com/LiMoMoMo/bigNumber"
        "fmt"
    )
    number, err := bigNumber.New(bigNumber.BINARY, "100011000100110110110111111100110100001001101001110")
    fmt.Println(number.BinaryStr(), number.DecimalStr())

reference

double-dabble

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCD

type BCD struct {
	// contains filtered or unexported fields
}

func NewBCD

func NewBCD(input []byte) (*BCD, error)

func (*BCD) Plus

func (b *BCD) Plus(arg int) error

func (*BCD) Value

func (b *BCD) Value() int

type BigNumber

type BigNumber struct {
	// contains filtered or unexported fields
}

func New

func New(t InitType, input string) (*BigNumber, error)

func (*BigNumber) BinaryStr

func (b *BigNumber) BinaryStr() string

func (*BigNumber) DecimalStr

func (b *BigNumber) DecimalStr() string

type InitType

type InitType int
const (
	DECIMAL InitType = iota
	BINARY
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL