math

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 3 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 ErrMultiplicationOverflow = errors.New("multiplication overflow")

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

View Source
var ErrSubtractionUnderflow = errors.New("subtraction underflow")

ErrSubtractionUnderflow is raised when there is an underflow because of the subtraction of two numbers

Functions

func AddInt32

func AddInt32(a, b int32) int32

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

func AddInt32WithError

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

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

func AddInt64

func AddInt64(a, b int64) int64

AddInt64 performs addition on int64 and logs 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 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 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

This section is empty.

Jump to

Keyboard shortcuts

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