math

package
v1.5.19 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAdditionOverflow = errors.New("addition overflow")

ErrAdditionOverflow is raised when there is an overflow because of the addition of two numbers

View Source
var ErrBigFloatAdd = errors.New("this big Float operation is not permitted while doing float.Add")

ErrBigFloatAdd is raised when add of floats produces a panic

View Source
var ErrBigFloatMul = errors.New("this big Float operation is not permitted while doing float.Mul")

ErrBigFloatMul is raised when mul of floats produces a panic

View Source
var ErrBigFloatQuo = errors.New("this big Float operation is not permitted while doing float.Quo")

ErrBigFloatQuo is raised when quo of floats produces a panic

View Source
var ErrBigFloatSqrt = errors.New("this big Float operation is not permitted while doing float.Sqrt")

ErrBigFloatSqrt is raised when sqrt of floats produces a panic

View Source
var ErrBigFloatSub = errors.New("this big Float operation is not permitted while doing float.Sub")

ErrBigFloatSub is raised when sub of floats produces a panic

View Source
var ErrMultiplicationOverflow = errors.New("multiplication overflow")

ErrMultiplicationOverflow is raised when there is an overflow because of the multiplication of two numbers

Functions

func AddBigFloat

func AddBigFloat(op1, op2 *big.Float) (result *big.Float, err error)

AddBigFloat addition implementation with error handling for big float

func AddInt32

func AddInt32(a, b int32) int32

AddInt32 performs addition on int32 and logs an error if the addition overflows

func AddInt32WithErr added in v1.5.6

func AddInt32WithErr(a, b int32) (int32, error)

AddInt32WithErr performs addition on int32 and returns an error if the addition overflows

func AddUint64

func AddUint64(a, b uint64) uint64

AddUint64 performs addition on uint64 and logs an error if the addition overflows

func AddUint64WithErr

func AddUint64WithErr(a, b uint64) (uint64, error)

AddUint64WithErr performs addition on uint64 and returns an error if the addition overflows

func MulBigFloat

func MulBigFloat(op1, op2 *big.Float) (result *big.Float, err error)

MulBigFloat multiplication implementation with error handling for big float

func MulUint64

func MulUint64(a, b uint64) uint64

MulUint64 performs multiplication on uint64 and logs an error if the multiplication overflows

func MulUint64WithErr

func MulUint64WithErr(a, b uint64) (uint64, error)

MulUint64WithErr performs multiplication on uint64 and returns an error if the multiplication overflows

func NewOverflowHandler added in v1.5.6

func NewOverflowHandler() *overflowHandler

NewOverflowHandler creates a new instance of type overflowHandler This struct is not concurrent safe and should be instantiated for each chain of operations required to be executed

func NewSeedRandReader

func NewSeedRandReader(seed []byte) *seedRandReader

NewSeedRandReader creates and returns a new SeedRandReader

func QuoBigFloat

func QuoBigFloat(op1, op2 *big.Float) (result *big.Float, err error)

QuoBigFloat quotient implementation with error handling for big float

func SqrtBigFloat

func SqrtBigFloat(op *big.Float) (result *big.Float, err error)

SqrtBigFloat sqrt implementation with error handling for big float

func SubBigFloat

func SubBigFloat(op1, op2 *big.Float) (result *big.Float, err error)

SubBigFloat subtraction implementation with error handling for big float

func SubInt

func SubInt(a, b int) int

SubInt performs subtraction on int and logs an error if the subtraction overflows

func SubUint64

func SubUint64(a, b uint64) uint64

SubUint64 performs subtraction on uint64, in case of underflow returns 0

Types

type RandomnessGenerator

type RandomnessGenerator interface {
	Read(p []byte) (n int, err error)
	IsInterfaceNil() bool
}

RandomnessGenerator will provide the interface to the main functionalities of the VM where randomness is needed

Jump to

Keyboard shortcuts

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