[fpc-pascal] Optimisation : X+X or 2*X or X*2 ?

Charles Edouard Des Vastes-Vignes charles.edouard.des.vastes.vignes at gmail.com
Sun Jan 19 21:45:10 CET 2014


That is right for positive integers. But for floating point numbers ?

Cheers, Raoul
Le 19 janv. 2014 21:23, "Philippe" <philippe at quarta.com.br> a écrit :

>  forgot
>
> X shl 1
>
> normaly the fastest ...
>
>
>
> Em 19.01.2014 17:47, Ched escreveu:
>
> Dear Freepascalers,
>
> The multiplication in floating arthmetic units is usualy know as being slower than the addition. So, have
> I interest to code X+X, 2*X or X*2 when using reals (mainly double and extended) ?And with integers ?
>
> Can the compiler optimise this operation choosing the fastest one - probably depending on the
> architecture x86, arm, aso.
>
> Cheers, Raoul
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.orghttp://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140119/7c78ba8d/attachment.html>


More information about the fpc-pascal mailing list