maths

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2018 License: Apache-2.0 Imports: 1 Imported by: 4

README

maths

makes Max Min easier

Go math pkg provides Max Min only for float64, this lib adds on for other types.

Why does Go not have feature X?

Install
go get github.com/andy2046/maths
Usage
func main() {
    iSlice := []int{1, 2, 3}
    i := IntVar.Max(iSlice...) // 3
    i = IntVar.Min(iSlice...) // 1
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StringVar represents instance of string.
	StringVar = new(String)
	// IntVar represents instance of int.
	IntVar = new(Int)
	// Int8Var represents instance of int8.
	Int8Var = new(Int8)
	// Int16Var represents instance of int16.
	Int16Var = new(Int16)
	// Int32Var represents instance of int32.
	Int32Var = new(Int32)
	// Int64Var represents instance of int64.
	Int64Var = new(Int64)
	// UintVar represents instance of uint.
	UintVar = new(Uint)
	// Uint8Var represents instance of uint8.
	Uint8Var = new(Uint8)
	// Uint16Var represents instance of uint16.
	Uint16Var = new(Uint16)
	// Uint32Var represents instance of uint32.
	Uint32Var = new(Uint32)
	// Uint64Var represents instance of uint64.
	Uint64Var = new(Uint64)
	// ByteVar represents instance of byte.
	ByteVar = new(Byte)
	// RuneVar represents instance of rune.
	RuneVar = new(Rune)
	// Float32Var represents instance of float32.
	Float32Var = new(Float32)
	// Float64Var represents instance of float64.
	Float64Var = new(Float64)
)

Functions

func Range

func Range(end int) []struct{}

Range creates a range progressing from zero up to, but not including end.

func Ternary

func Ternary(expr bool, trueVal, falseVal interface{}) interface{}

Ternary for no ternary operation in Go.

Types

type Byte

type Byte byte

Byte represents type byte.

func (Byte) Max

func (Byte) Max(numerics ...byte) byte

Max returns the largest in numerics.

func (Byte) Min

func (Byte) Min(numerics ...byte) byte

Min returns the smallest in numerics.

type Float32

type Float32 float32

Float32 represents type float32.

func (Float32) Max

func (Float32) Max(numerics ...float32) float32

Max returns the largest in numerics.

func (Float32) Min

func (Float32) Min(numerics ...float32) float32

Min returns the smallest in numerics.

type Float64

type Float64 float64

Float64 represents type float64.

func (Float64) Max

func (Float64) Max(numerics ...float64) float64

Max returns the largest in numerics.

func (Float64) Min

func (Float64) Min(numerics ...float64) float64

Min returns the smallest in numerics.

type Int

type Int int

Int represents type int.

func (Int) Max

func (Int) Max(numerics ...int) int

Max returns the largest in numerics.

func (Int) Min

func (Int) Min(numerics ...int) int

Min returns the smallest in numerics.

type Int16

type Int16 int16

Int16 represents type int16.

func (Int16) Max

func (Int16) Max(numerics ...int16) int16

Max returns the largest in numerics.

func (Int16) Min

func (Int16) Min(numerics ...int16) int16

Min returns the smallest in numerics.

type Int32

type Int32 int32

Int32 represents type int32.

func (Int32) Max

func (Int32) Max(numerics ...int32) int32

Max returns the largest in numerics.

func (Int32) Min

func (Int32) Min(numerics ...int32) int32

Min returns the smallest in numerics.

type Int64

type Int64 int64

Int64 represents type int64.

func (Int64) Max

func (Int64) Max(numerics ...int64) int64

Max returns the largest in numerics.

func (Int64) Min

func (Int64) Min(numerics ...int64) int64

Min returns the smallest in numerics.

type Int8

type Int8 int8

Int8 represents type int8.

func (Int8) Max

func (Int8) Max(numerics ...int8) int8

Max returns the largest in numerics.

func (Int8) Min

func (Int8) Min(numerics ...int8) int8

Min returns the smallest in numerics.

type Rune

type Rune rune

Rune represents type rune.

func (Rune) Max

func (Rune) Max(numerics ...rune) rune

Max returns the largest in numerics.

func (Rune) Min

func (Rune) Min(numerics ...rune) rune

Min returns the smallest in numerics.

type String

type String string

String represents type string.

func (String) Max

func (String) Max(numerics ...string) string

Max returns the largest in numerics.

func (String) Min

func (String) Min(numerics ...string) string

Min returns the smallest in numerics.

type Uint

type Uint uint

Uint represents type uint.

func (Uint) Max

func (Uint) Max(numerics ...uint) uint

Max returns the largest in numerics.

func (Uint) Min

func (Uint) Min(numerics ...uint) uint

Min returns the smallest in numerics.

type Uint16

type Uint16 uint16

Uint16 represents type uint16.

func (Uint16) Max

func (Uint16) Max(numerics ...uint16) uint16

Max returns the largest in numerics.

func (Uint16) Min

func (Uint16) Min(numerics ...uint16) uint16

Min returns the smallest in numerics.

type Uint32

type Uint32 uint32

Uint32 represents type uint32.

func (Uint32) Max

func (Uint32) Max(numerics ...uint32) uint32

Max returns the largest in numerics.

func (Uint32) Min

func (Uint32) Min(numerics ...uint32) uint32

Min returns the smallest in numerics.

type Uint64

type Uint64 uint64

Uint64 represents type uint64.

func (Uint64) Max

func (Uint64) Max(numerics ...uint64) uint64

Max returns the largest in numerics.

func (Uint64) Min

func (Uint64) Min(numerics ...uint64) uint64

Min returns the smallest in numerics.

type Uint8

type Uint8 uint8

Uint8 represents type uint8.

func (Uint8) Max

func (Uint8) Max(numerics ...uint8) uint8

Max returns the largest in numerics.

func (Uint8) Min

func (Uint8) Min(numerics ...uint8) uint8

Min returns the smallest in numerics.

Jump to

Keyboard shortcuts

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