math

package
v0.0.0-...-8e7861b Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[T constraints.Number](x, y T) T

func CeilToSigFigs

func CeilToSigFigs[T float32 | float64](x T, n int) T

Rounds the given number up to n significant figures.

func FloorToSigFigs

func FloorToSigFigs[T float32 | float64](x T, n int) T

Rounds the given number down to n significant figures.

func GCD

func GCD[T go_constraints.Integer](a, b T) T

Assumes positive inputs. Adapted from https://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations.

func LCM

func LCM[T go_constraints.Integer](a, b T) T

Assumes positive inputs.

func Max

func Max[T constraints.Number](x, y T) T

func Min

func Min[T constraints.Number](x, y T) T

func RoundToSigFigs

func RoundToSigFigs[T float32 | float64](x T, n int) T

Rounds the given number to n significant figures.

Types

This section is empty.

Jump to

Keyboard shortcuts

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