How to compute power in the ROOT prompt

Hello, I tried to perform some quick power calculation in the ROOT prompt as shown below

root
   ------------------------------------------------------------
  | Welcome to ROOT 6.06/00                [root.cern.ch](http://root.cern.ch) |
  |                               (c) 1995-2014, The ROOT Team |
  | Built for linuxx8664gcc                                    |
  | From tag v6-06-00, 9 December 2015                         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] 2^2
(int) 0
root [1] 2^3
(int) 1
root [2] 2^4
(int) 6
root [3] 2^5
(int) 7
root [4] 2^6
(int) 4
root [5] 2^7
(int) 5
root [6] 2^8
(int) 10
root [7] 2^10
(int) 8

As you see, the “^” character does not look to be the “power operator”. What is “^” and how to write 2²?

Hi,

you can always rely on the pow function, e.g. pow(2,3).

Cheers,
D

The C/C++ operator ^ is the ‘exclusive or’ operator and not the power.

Thanks for the explanation.

cplusplus.com/reference/cmath/pow/