I am trying to use
** operator to calculate the 2 power 32. But I keep getting an error saying
invalid indirect of 32 (type untyped number)
It is considering the second * to mean pointer to 32.
Isn’t 2**32 a valid expression?
I see that it is used in the comment of this documentation https://golang.org/pkg/math/
However I don’t see this being used elsewhere.
No, golang has no power operator by itself. The
math package though provides a function for floats. For Integers you need to implement them on your own, but be aware of the fact that you’ll be out of bounds pretty quickly…
Go does not power operator (** or ^ or whatever).
Yes, you can use ,math package and Pow to make the math.
Any reason why Go did not add this as an operator, this is a basic operator. I am only curious!
jeje, No clue too!!. It could be a Go’s parents decision…
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.