arith

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrOverflow is returned when an arithmetic operation exceeds the
	// maximum value that can be represented by the underlying type.
	ErrOverflow = errors.New("integer overflow")
)

Functions

func Add

func Add[T constraints.Unsigned](a, b T) lfn.Result[T]

Add returns the sum of a and b. If the addition overflows the underlying unsigned integer type, an error result is returned.

func CheckAdd

func CheckAdd[T constraints.Unsigned](a, b T) error

CheckAdd checks whether adding a and b would overflow the underlying unsigned integer type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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