Complex power function faster with floats then with integers

Hey there,
i work with gpuArrays in Matlab and habe something like this:

a = 0.234 + 0.8234i; %so some complex number

Then i do the power function with lets say 100.000.000 numbers, lets call them p. p can be all integers, from 1 to 1000 maybe, or all be some arbitrary float from 1 to 1000.

Example for one value of p:
Case 1: p = 2.000
Case 2: p = 2.292

The power function: b = a.^(p);

And i’m doint this for all 100 million numbers in chunks in parallel. p and a are all single precision float numbers.

My issue: Case 1 (Integer Case) is far slower, then the float case. Takes around 4 times as long.

Does Anyone have any Idea, what the reason could be?

Thank you VERY much in advance


EDIT:
I got a “MSI GeForce GTX 1060 Armor 6G OC”

you might want to ask your question on a matlab gpu computing forum

[url]MATLAB Answers - MATLAB Central

Thank you first of all. I was just trying my luck here, bc maybe there is some optimization going on ect…

a lot of math operations on the GPU are faster with floats than with integers

you don’t mention which GPU you are running on, which certainly matters, but, to pick one example, the throughput of 32-bit floating point multiply is much higher than the throughput of 32-bit integer multiply on many GPU architectures.

[url]https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#arithmetic-instructions__throughput-native-arithmetic-instructions[/url]

Certainly attempting to apply such an observation to matlab code would only be valid if you understood the matlab-> CUDA implementation under the hood, which presumably is only known by mathworks engineers.

Sorry about that, I forgot:
I got a “MSI GeForce GTX 1060 Armor 6G OC” running!

Edit:
Thats means I have a compute capability (CC) 6.1
Could you please give a quick run down, how a power function is implemented? Which arithmetic instructions are used?
It only says “base 2 exponential”, but that doesnt cover the whole deal, does it? :)
Thank you very much for now. You helped me a lot!

If you do a google search on “raising a complex number to a power” you will quickly find possible answers to your question, including DeMoivre’s theorem.

However I have no idea what method (or methods) is/are used by the Mathworks in Matlab. Only they could tell you that.

I also imagine there might be algorithmic differences depending on whether you are talking about raising a complex number to a real power, complex number to a complex power, or real number to a complex power, in addition to perhaps different algorithms for floating point or integer components. Math libraries often have multiple paths that may be followed for a particular operation, depending on the operands.

For example, if you were raising a complex number to a positive integer (real) power, you might use “ordinary” complex multiplication for low integer ranges. But you might use DeMoivre’s theorem when the exponent is real but floating-point.