Documentation ¶
Overview ¶
Package numbers implements various numerical functions.
Index ¶
- func Abs(x int) int
- func DegreesToRadians(degrees int) float64
- func MinMax(values []float64) (min, max float64)
- func MinMaxInts(values []int) (min, max int)
- func RadiansToDegrees(radians float64) int
- func RoundToNonZeroPlaces(f float64, places int) (float64, int)
- func SimplifyRatio(ratio image.Point) image.Point
- func SplitByRatio(n int, ratio image.Point) image.Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DegreesToRadians ¶
DegreesToRadians converts degrees to the equivalent in radians.
func MinMax ¶
MinMax returns the smallest and the largest value among the provided values. Returns (0, 0) if there are no values. Ignores NaN values. Allowing NaN values could lead to a corner case where all values can be NaN, in this case the function will return NaN as min and max.
func MinMaxInts ¶
MinMaxInts returns the smallest and the largest int value among the provided values. Returns (0, 0) if there are no values.
func RadiansToDegrees ¶
RadiansToDegrees converts radians to the equivalent in degrees.
func RoundToNonZeroPlaces ¶
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 ¶
SimplifyRatio simplifies the given ratio.
Types ¶
This section is empty.