Jump to content

Exponentiation operator: Difference between revisions

add RPL - zero power case for matrice
m (add RPL)
(add RPL - zero power case for matrice)
Line 3,089:
=={{header|RPL}}==
RPL can not overload operators, but does often handle many data types - including unsigned integers and floating-point numbers - with same methods, which makes code compact and versatile. The one-line program below can exponentiate real and complex numbers, but also matrices.
'''IF''' DUP NOT '''THEN''' DROP DUP TYPE 3 == SWAP IDN 1 IFTE '''ELSE''' 1 1 ROT '''START''' OVER * '''ENDNEXT''' SWAP DROP '''END''' ≫ ‘'''POWER'''’ STO
 
25.2 3 '''POWER'''
Line 3,102:
3: -15625
2: (-142,-65)
1: [[ 11637 15354 ][ 20481 269118 ]]
</pre>
 
1,150

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.