Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I calculate this?

Status
Not open for further replies.

junshi

Technical User
Feb 5, 2003
2
KR
I can't find out the method of mathematical symbol--- power!
There is no Functin in any RPG references.

I have to do this calculation.

x^y = x multified by x at eight times.
x and y are real numbers.
again,
x^y means "pow(x,y)" in C language.

please Help me.
 
Try using the exponentiation operator '**'.

i.e.

2**3=8
4**2=16

Hope this helps

[2thumbsup] --------------------------------
If it ain't broke, don't fix it!
 
Huum...
symbol '**' can not work in RPG III.
and "pow(a,b)" subject to a,b are all real number!
 
True '**' cannot be used in rpgiii.

If your not willing or able to use rpgiv then the only other way I can think off is to use a do loop to multiply x by itself y times.

I have not tried this but I think it should work.

y dowlt 1
mult x x
sub 1 y
enddo


--------------------------------
If it ain't broke, don't fix it!
 
Sorry that should be DOWGT not dowlt.
--------------------------------
If it ain't broke, don't fix it!
 
I was going to suggest that.

You should probably make it an API, and also consider an if or case statement if the power is --

* 0,
* 1,
* negative.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top