xmath

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package xmath contains extensions to the standard library package math.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T ~int | ~int8 | ~int16 | ~int32 | ~int64](x T) T

Abs returns the absolute value of x. It panics if this value is not representable, for example because -math.MinInt32 requires more than 32 bits to represent and so does not fit in an int32.

func Clamp

func Clamp[T cmp.Ordered](x, min, max T) T

Clamp clamps the value of x to within min and max.

func Max deprecated

func Max[T cmp.Ordered](a, b T) T

Max returns the maximum of a and b based on the > operator.

Deprecated: max is a builtin as of Go 1.21.

func Min deprecated

func Min[T cmp.Ordered](a, b T) T

Min returns the minimum of a and b based on the < operator.

Deprecated: min is a builtin as of Go 1.21.

Types

This section is empty.

Directories

Path Synopsis
Package xrand contains extensions to the standard library package math/rand.
Package xrand contains extensions to the standard library package math/rand.

Jump to

Keyboard shortcuts

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