numbers

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package numbers implements various numerical functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x int) int

Abs returns the absolute value of x.

func DegreesToRadians

func DegreesToRadians(degrees int) float64

DegreesToRadians converts degrees to the equivalent in radians.

func MinMax

func MinMax(values []float64) (min, max float64)

MinMax returns the smallest and the largest value among the provided values. Returns (0, 0) if there are no values.

func MinMaxInts

func MinMaxInts(values []int) (min, max int)

MinMaxInts returns the smallest and the largest int value among the provided values. Returns (0, 0) if there are no values.

func RadiansToDegrees

func RadiansToDegrees(radians float64) int

RadiansToDegrees converts radians to the equivalent in degrees.

func Round

func Round(x float64) float64

Round returns the nearest integer, rounding half away from zero. Copied from the math package of Go 1.10 for backwards compatibility with Go 1.8 where the math.Round function doesn't exist yet.

func RoundToNonZeroPlaces

func RoundToNonZeroPlaces(f float64, places int) (float64, int)

RoundToNonZeroPlaces rounds the float up, so that it has at least the provided number of non-zero decimal places. Returns the rounded float and the number of leading decimal places that are zero. Returns the original float when places is zero. Negative places are treated as positive, so that -2 == 2.

func SimplifyRatio

func SimplifyRatio(ratio image.Point) image.Point

SimplifyRatio simplifies the given ratio.

func SplitByRatio

func SplitByRatio(n int, ratio image.Point) image.Point

SplitByRatio splits the provided number by the specified ratio.

Types

This section is empty.

Directories

Path Synopsis
Package trig implements various trigonometrical calculations.
Package trig implements various trigonometrical calculations.

Jump to

Keyboard shortcuts

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