mathutil

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DivideCeil

func DivideCeil(count int64, pageSize int64) int64

DivideCeil divides two integers and rounds up, rather than down (which is what happens when you do int64/int64).

func IsSignedZero

func IsSignedZero(f float64) bool

IsSignedZero checks if this number is a signed zero (i.e. -0, instead of +0).

func Limit

func Limit(v, lower, upper float64) float64

Limit a value between a lower and upper limit.

func Max

func Max(a, b int64) int64

Max gets the highest of two numbers.

func Min

func Min(a, b int64) int64

Min gets the lowest of two numbers.

func NonZero added in v1.4.2

func NonZero(a, b int64, c ...int64) int64

NonZero returns the first argument that is not 0. It will return 0 if all arguments are 0.

func Round

func Round(f float64) float64

Round will round the value to the nearest natural number.

.5 will be rounded up.

func RoundPlus

func RoundPlus(f float64, precision int) float64

RoundPlus will round the value to the given precision.

e.g. RoundPlus(7.258, 2) will return 7.26

Types

type Byte

type Byte float64

Byte is a float64 where the String() method prints out a human-redable description.

func (Byte) String

func (b Byte) String() string

Jump to

Keyboard shortcuts

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