I need to perform operations, such as exponentiation and division, on large values of int64 in Go, but I have problems with overflow. I tried converting them to float64, but then I run into other problems. Here is what I tried.
I have an integer variable, which I had to cast into a float64 to use the handy math package (https://golang.org/pkg/math).
However, it doesn't cast correctly when the integer variable is too big. I'm assuming it's because the size is bigger than float64. ex:
fmt.Printf("%f",float64(111111111111111110)) //Outputs 111111111111111104.000000
I'm trying to use math.Mod, math.Pow10, and math.Log10. How would I be able to do the following logic, but with a large number shown above?
int(math.Mod(float64(123) / math.Pow10(1),10))) // Gets the second digit