Anonymous user
Exponentiation operator: Difference between revisions
m
→{{header|REXX}}: added code to support more special cases, changed comments.
(→{{header|REXX}}: re-did the output to reflect calculations from iPow function, also showed more examples of special cases, added comments.) |
m (→{{header|REXX}}: added code to support more special cases, changed comments.) |
||
Line 2,460:
errMsg: say; say '***error***'; say; say arg(1); say; say; exit 13
/*──────────────────────────────────────────────────────────────────────────────────────*/
iPow: procedure; parse arg x 1 _,p; #args=
if
if
if \datatype(x, 'N') then call errMsg "1st arg isn't numeric:" x
if \datatype(p, 'W') then call errMsg "2nd arg isn't an integer:" p
if p=0 then return 1
if x=0 |
do abs(p) - 1; _= _ * x; end
if p<0 then _= 1 / _
return _</lang>
{{out|output|text= when using the internal default inputs:}}
|