- Joined
- Apr 24, 2012
- Messages
- 5,113
[jass=]function RaiseRealNumberPower takes real r , integer p returns real
local real cr = r
local integer l
loop
exitwhen l == p + 1
set r = r * cr
set l = l + 1
endloop
if r <= 0 and cr != 0 then
set r = 1000000000
endif
return r
endfunction
//===============================================
function RaiseIntegerNumberPower takes integer i , integer p returns integer
local integer ci = i
local integer l
loop
exitwhen l == p + 1
set i = i * ci
set l = l + 1
endloop
if i <= 0 and ci != 0 then
set i = 1000000000
endif
return i
endfunction[/code]
Just a simple snippet from me.
I cant think of other names so i named it like this.
This snippet is just like squares and cubes,but limitless.
I used that if block because it will return negatives once the number reaches over the max value.
local real cr = r
local integer l
loop
exitwhen l == p + 1
set r = r * cr
set l = l + 1
endloop
if r <= 0 and cr != 0 then
set r = 1000000000
endif
return r
endfunction
//===============================================
function RaiseIntegerNumberPower takes integer i , integer p returns integer
local integer ci = i
local integer l
loop
exitwhen l == p + 1
set i = i * ci
set l = l + 1
endloop
if i <= 0 and ci != 0 then
set i = 1000000000
endif
return i
endfunction[/code]
Just a simple snippet from me.
I cant think of other names so i named it like this.
This snippet is just like squares and cubes,but limitless.
I used that if block because it will return negatives once the number reaches over the max value.