bigint

package
v0.64.6 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBaseInvalid = errors.New("invalid base - must be between [2,62]")
View Source
var ErrSetStringFailure = errors.New("string conversion to `*big.Int` failed")

Functions

func BaseXAlphabetToInt64 added in v0.47.0

func BaseXAlphabetToInt64(s string, alphabet string) (int64, error)

func BaseXToInt64 added in v0.47.0

func BaseXToInt64(s string, base int) (int64, error)

func Copy

func Copy(x *big.Int) *big.Int

Copy returns a copy of a `*big.Int`

func DecodeString added in v0.42.0

func DecodeString(base int, s string) ([]byte, error)

func Div

func Div(a, b *big.Int) *big.Int

Div devides a by b and returns a new `*big.Int`

func EncodeToString added in v0.42.0

func EncodeToString(base int, s []byte) (string, error)

EncodeToString uses [0-9a-zA-Z] for base62.

func Equal added in v0.46.0

func Equal(x, y *big.Int) bool

Equal checks if a == b.

func Int64ToBaseX added in v0.47.0

func Int64ToBaseX(x int64, base int) string

func Int64ToBaseXAlphabet added in v0.47.0

func Int64ToBaseXAlphabet(x int64, alphabet string) (string, error)

func IntToHex

func IntToHex(x *big.Int) string

IntToHex converts a `*big.Int` to a hex string.

func Mod

func Mod(a, n *big.Int) *big.Int

Mod performs `a mod n`

func ModInt64 added in v0.46.0

func ModInt64(a, n int64) int64

ModInt64 returns an int64 mod

func MustEncodeToString added in v0.42.0

func MustEncodeToString(base int, s []byte) string

MustEncodeToString uses [0-9a-zA-Z] for base62.

func NewIntHex added in v0.46.0

func NewIntHex(hexNumStr string) (*big.Int, error)

NewIntHex converts a hex string to a `*big.Int`.

func NewIntString

func NewIntString(val string) (*big.Int, error)

NewIntString creates a new `*big.Int` from an uint64.

func NewIntUint64

func NewIntUint64(val uint64) *big.Int

NewIntUint64 creates a new `*big.Int` from an uint64.

func ParseScientificNotation added in v0.55.0

func ParseScientificNotation(s string) (*big.Int, big.Accuracy, error)

func Pow

func Pow(x, y *big.Int) *big.Int

Pow is the power function for big ints.

func PowInt64 added in v0.46.0

func PowInt64(x, y int64) int64

func SplitInt64 added in v0.47.0

func SplitInt64(x int64, scale uint) (int64, int64)

Types

This section is empty.

Jump to

Keyboard shortcuts

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