Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Time to think about supporting max/min functions for integers in GoLang

Sometime back we wrote a post explaining why there is no max/min function support for integers in GoLang, one of the reasons is that no overloading is supported and the function name has been used for other numeric types float64. To solve this problem and make max/min function support integer as well, either GoLang should support overloading like in Java or the same set of functions need to be created in a different package other than standard math. These don't look like good options as overloading is more a OOP concept and supporting the same set of functions in a different package doesn't so...

4,888 0       GOLANG GENERICS MAX MIN


  Why no max/min function for integer in GoLang

You may notice that there is no max/min function provided to compare the maximum/minimum of two or more integers if you are a GoLang developer with some experience . In other languages, these functions are provided as part of the core lib functions. Have you wondered why? Indeed GoLang provides max/min function in math package, but they are used for comparing float64 data type. The signature of these two functions aremath.Min(float64, float64) float64math.Max(float64, float64) float64The reason why GoLang provides the max/min function for comparing float64 numbers are that floating n...

55,636 12       GOLANG INT64 MAX INT