bigmath

package
v0.0.0-...-47b5856 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 1 Imported by: 7

Documentation

Overview

Package bigmath compensates for awkward big.Int API. Can cause an extra allocation or two.

Index

Constants

This section is empty.

Variables

View Source
var (
	Zero  = big.NewInt(0)
	One   = big.NewInt(1)
	Two   = big.NewInt(2)
	Three = big.NewInt(3)
	Four  = big.NewInt(4)
	Seven = big.NewInt(7)
)

nolint

Functions

func Accumulate

func Accumulate(s []*big.Int) (r *big.Int)

Accumulate returns the sum of the given slice.

func Add

func Add(addend1, addend2 *big.Int) *big.Int

Add performs addition with the given values.

func AddPercentage

func AddPercentage(value *big.Int, percentage uint16) *big.Int

Returns the input value increased by the given percentage.

func Div

func Div(dividend, divisor *big.Int) *big.Int

Div performs division with the given values.

func Equal

func Equal(left, right *big.Int) bool

Equal compares the given values.

func Exp

func Exp(base, exponent, modulus *big.Int) *big.Int

Exp performs modular eponentiation with the given values.

func I

func I() *big.Int

I returns a new big.Int.

func Max

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

Max returns the maximum of the two given values.

func Min

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

Min returns the min of the two given values.

func Mod

func Mod(dividend, divisor *big.Int) *big.Int

Mod performs modulus with the given values.

func Mul

func Mul(multiplicand, multiplier *big.Int) *big.Int

Mul performs multiplication with the given values.

func Sub

func Sub(minuend, subtrahend *big.Int) *big.Int

Sub performs subtraction with the given values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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