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

Ched charles.edouard.des.vastes.vignes at gmail.com
Sun Jan 19 20:47:33 CET 2014


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



More information about the fpc-pascal mailing list