github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/bmath/README.md (about)

     1  # bmath
     2  
     3  ## API
     4  
     5  - Max
     6  - Min
     7  - Abs
     8  
     9  ## EXAMPLE
    10  
    11  ```go
    12  package main
    13  
    14  import (
    15  	"fmt"
    16  	"github.com/songzhibin97/go-baseutils/base/bmath"
    17  )
    18  
    19  func main() {
    20  	fmt.Println(bmath.Abs[int](1))  // 1
    21  	fmt.Println(bmath.Abs[int](0))  // 0
    22  	fmt.Println(bmath.Abs[int](-1)) // 1
    23  
    24  	fmt.Println(bmath.Max[int](1, 2)) // 2
    25  
    26  	fmt.Println(bmath.Min[int](1, 2)) // 1
    27  }
    28  ```