BeSly Software Solutions About yab About us Admin




Name:

** or ^ -- raise its first argument to the power of its second

Synopsis:
print 2**b 
print 3^4 

Description:
** (or ^, which is an exact synonym), is the arithmetic operator of exponentiation; it requires one number to its left and a second one to its right; 
** then raises the first argument to the power of the second and returns the result. The result will only be computed if it yields a real number (as opposed to a complex number);
this means, that the power can not be computed, if the first argument is negative and the second one is fractional.
On the other hand, the second argument can be fractional, if the first one ist positive; this means, that ** may be used to compute arbitrary roots: e.g. x**0.5 computes the square root of x.

Example:
print 2**0.5 


Related: sqrt