Don't use POW function for value of power less or ugual to 40. It is very slow
Try this code
Ciao
[attachment deleted by admin]
My timings (on the PC) are including. Wonder why its 10 times slower ? :blink:
[attachment deleted by admin]
POW allows exponents that aren't positive integers, hence requiring more complicated code than multiplying the base out a few times :P
Right
Try this for negative elevations (not too complicated) :). Is always faster
Obviously this program does not work for elevations greater than 0 and less than 1
Ciao
[attachment deleted by admin]
I forgot to add that the elevations should not be decimal.
3, 5, 6, -4, -6 yes
-3,5, 5.67 no
Ciao
Which is exactly where POW differs from this integer exponent functions :good:
But where it is very useful in calculations of the type Bezier algorithm:
B(t)=(1-t)5P1 + 5t(1-t)4P2 + 10t2(1-t)3P3 + 10t3(1-t)2P4 + 5t4(1-t)P5+ t5P6
Ciao
it'S 10x slower, because it's a very quick function, that calls the native "pow", which is also very quick. I think the delay comes from the calling overhead.