mathhelper

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 3 Imported by: 2

README

mathhelper

Go Reference

Helpers for Go's math package.

Documentation

Overview

Package mathhelper contains math package helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T constraints.Integer | constraints.Float](x T) T

Abs returns the absolute value of 'x'.

func Frac

func Frac[T constraints.Float](f T) T

Frac returns the fractional part of 'f'.

func IntMax

func IntMax[T constraints.Integer](m, n T) T

IntMax returns the larger of 'm' or 'n'.

func IntMin

func IntMin[T constraints.Integer](m, n T) T

IntMin returns the smaller of 'm' or 'n'.

func IsEven

func IsEven[T constraints.Integer](i T) bool

IsEven reports whether 'i' is even.

func Split added in v0.2.0

func Split[T constraints.Integer](n, parts T) ([]T, error)

Split splits 'n' into 'parts' as equal as possible integer parts. Slice with parts' lengths is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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