Question: Why does codegen:cost count a square root as two function calls?

I am currently trying to evaluate the performance of different methods for the same calculation and use codegen:cost to give me an overview on the rough computational effort for the results. I stumbled over the function counts not matching my own count in the optimized Matlab code generated by Maple.

Minimal example:

with(codegen):
Fcn1 := sqrt(a):
cost(Fcn1);
Fcn2 := sqrt(sin(q)):
cost(Fcn2);

The first expression gives me "2*functions+multiplications", the second one "3*functions+multiplications".

So my question: Does anyone know, why the square root is counted as two functions while the sine is counted correctly as one?

Please Wait...