Power

Monkey Forums/Monkey Programming/Power

Playniax(Posted 2011) [#1]
In BlitzMax I could do this :

Print 8 ^ 2
or
Print 8 ^ 6

Is there a fast way to do this in Monkey?

I can't find it.


Xaron(Posted 2011) [#2]
Print Pow( 8, 2 )


Playniax(Posted 2011) [#3]
Yep, Thanks! That did it.


rIKmAN(Posted 2013) [#4]
Sorry to bump such an old thread, but it's relevant as I've just been stumped by the new alternative to ^ as well, which as I found out via search (and this thread) is Pow().

Can someone confirm that this Blitz code:
Print(Sqr((a - b)^2 + (c + d)^2)/100)

...becomes this in Monkey:
Print(Sqrt(Pow(a - b, a - b)) + (Pow(c - d, c - d)) / 100)

I'm having a few issues and just want to make sure I've got it right before I start looking elsewhere.

Thanks.


Jesse(Posted 2013) [#5]
Print (Sqrt(Pow(a-b,2)+ Pow(c-d,2))/100)



rIKmAN(Posted 2013) [#6]
Of course - what an idiot! *sigh*

Thanks Jesse


ElectricBoogaloo(Posted 2013) [#7]
Things I learned a long time ago that are probably completely and totally useless, and outdated, nowadays.

.. It used to be a teensy bit quicker to do ((a-b)*(a-b)) than (a-b)^2
That's probably irrelevant, though.