math

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bounds

type Bounds[T cmp.Ordered] struct {
	Lower, Upper T
	// Open signifies whether the corresponding bound is open or not
	Open [2]bool
}

Bounds represents the bounds of an Ordered value.

func NewBounds

func NewBounds[T cmp.Ordered](lower, upper T, lowerOpen, upperOpen bool) (bounds Bounds[T], e error)

NewBounds returns a Bounds object, returning a non-nil error if the bounds are not valid.

func (Bounds[T]) Contains

func (bounds Bounds[T]) Contains(value T) (contains bool)

func (Bounds[T]) Equal

func (bounds Bounds[T]) Equal(other Bounds[T]) bool

Equal reports whether the two Bounds are equal.

func (Bounds[T]) String

func (bounds Bounds[T]) String() string

func (Bounds[T]) Valid

func (bounds Bounds[T]) Valid() (e error)

Valid tests whether the bounds are valid, returning a non-nil error if they are not.

type InvalidBoundsError

type InvalidBoundsError[T cmp.Ordered] struct {
	Bounds Bounds[T]
	Reason string
}

func (InvalidBoundsError[T]) Error

func (e InvalidBoundsError[T]) Error() string

Jump to

Keyboard shortcuts

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