Question:
I (apparently wrongly) assumed there would be a built-in power operator
or function
in Powershell, but I it seems there is not, or is there?
Answer:
As you’ve found, real exponentation can be achieved with some accuracy by calling [Math]::Pow()
.
For large integer exponentiation, you might want to use [bigint]::Pow()
instead:
1 2 3 4 5 |
PS ~> [Math]::Pow(256, 20) 1.4615016373309E+48 PS ~> [bigint]::Pow(256, 20) 1461501637330902918203684832716283019655932542976 |