math.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package utils
  2. var UtimesNumberMap = map[string]int{
  3. "一": 1,
  4. "二": 2,
  5. "三": 3,
  6. "四": 4,
  7. "五": 5,
  8. "六": 6,
  9. "七": 7,
  10. "八": 8,
  11. "九": 9,
  12. "十": 10,
  13. "两": 2,
  14. "1": 1,
  15. "2": 2,
  16. "3": 3,
  17. "4": 4,
  18. "5": 5,
  19. "6": 6,
  20. "7": 7,
  21. "8": 8,
  22. "9": 9,
  23. "10": 10}
  24. //返回最小值 int
  25. func MinIntBetween(left int, right int) int {
  26. if left <= right {
  27. return left
  28. }
  29. return right
  30. }
  31. //返回最小值 int64
  32. func MinInt64Between(left int64, right int64) int64 {
  33. if left <= right {
  34. return left
  35. }
  36. return right
  37. }
  38. //返回最大值 int
  39. func MaxIntBetween(left int, right int) int {
  40. if left >= right {
  41. return left
  42. }
  43. return right
  44. }
  45. //返回最大值 int64
  46. func MaxInt64Between(left int64, right int64) int64 {
  47. if left >= right {
  48. return left
  49. }
  50. return right
  51. }
  52. //返回最大值 Float64
  53. func MinFloat64Between(left float64, right float64) float64 {
  54. if left >= right {
  55. return right
  56. }
  57. return left
  58. }
  59. //返回最小值 Float64
  60. func MaxFloat64Between(left float64, right float64) float64 {
  61. if left <= right {
  62. return right
  63. }
  64. return left
  65. }