Documentation
¶
Overview ¶
Additional functions for math calculation that are missing in the standard library.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Avg ¶ added in v0.3.5
Returns the average value of the given values.
Example ¶
package main
import (
"fmt"
"github.com/ayonli/goext/mathx"
)
func main() {
fmt.Println(mathx.Avg(1))
fmt.Println(mathx.Avg(1, 2))
fmt.Println(mathx.Avg(1, 2, 3))
}
Output: 1 1.5 2
func Max ¶
Returns the maximal value from the given values.
Example ¶
package main
import (
"fmt"
"github.com/ayonli/goext/mathx"
)
func main() {
fmt.Println(mathx.Max(1))
fmt.Println(mathx.Max(1, 2))
fmt.Println(mathx.Max(1, 2, 0.5))
}
Output: 1 2 2
func Min ¶
Returns the minimal value from the given values.
Example ¶
package main
import (
"fmt"
"github.com/ayonli/goext/mathx"
)
func main() {
fmt.Println(mathx.Min(1))
fmt.Println(mathx.Min(1, 2))
fmt.Println(mathx.Min(1, 2, 0.5))
}
Output: 1 1 0.5
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.