Read-only archive of the All About Symbian forum (2001–2013) · About this archive

"^" -> is there some function?

6 replies · 2,069 views · Started 07 December 2004

If I use for example x^2 instead SQR(x) it tells error.

I need for example x^50, how can I write it (exists some function etc..)? I cann't find anything in WIKI.

btw similar problem I have with for example 10th extraction...

thanks

Perhaps something like this? Everyone should know how to do this...
n^x:

proc power%😞n%,x%)
local z%,i%
i%=1
z%=1
IF x%=0
return 1
endif
do
z%=z%*n%
until i%>x%
return z%
endp

This was written thinking fast and without testing...

Hi,

Just use :

x**n

where n is a real number and x is a positive real number. So you can apply it to solve your problems :

x**50
x**(1/10)

Regards, Roberto

Thx, x**n is running good, but if I use x**(1/n) it constantly write only "1".

For example:

PROC pow:
PRINT 1000**(1/3) REM It should be 10, but it is 1
GET
ENDP

Try to use convert the power to a real number, for example :

PROC pow:
PRINT 1000**(1./3) REM It is 10 as expected.
GET
ENDP

I was not aware about this detail...