Christophe,
I'm not making a general comparison between multiplication and
exponentiation, I'm comparing exponentiation to the power 2 using the
hat operator ^ with a valid --and simpler-- procedure to get the same
result, i.e., multiplying the base times itself.
I believe that functions and
Hello,
General
-Message d'origine-
De : users De la part de Federico Miyara
Envoyé : jeudi 30 novembre 2023 16:52
>
> confirm that, [...] the simple squaring operation takes much longer than it
> should.
Except that the power is not a multiplication.
It is a fact that amongst the
Heinz,
Thank you for your timings, which confirm that, even if about an order
of magnitude faster (I use a rather old i7 laptop), the simple squaring
operation takes much longer than it should.
Regards,
Federico Miyara
On 30/11/2023 02:14, Heinz Nabielek wrote:
Thanks. In the 1960s FORTRAN,
Thanks. In the 1960s FORTRAN, we would always write A2=A*A rather than A2=A**2.
Below the Federico examples on my M1 Apple silicon iMac:
Heinz
--> tic, u = rand(1,1e7); toc
ans = 0.111413
--> tic, v = sqrt(u); toc
ans = 0.0384130
--> tic, v = u.*u; toc
ans = 0.023148
--> tic, v =