rem rem - 3 months ago 15
R Question

Computational cost of arithmetics in R

What is the computational cost of arithmetic operations in R? E.g. does multiplication of two 32-bit integers take constant time with regard to their magnitude?

Answer

If you look here you'll see that in R, integer multiplication simply calls the C integer-multiplication operator. So the only answer I can give to "what is the computational cost of integer multiplication in R?" is "the same as the computational cost of integer multiplication with whatever C compiler has been used to compile R"; the answer to that question will usually be "the same as the computational cost of the integer-multiplication machine instruction (e.g., IMUL) on the particular chip on which you are running".

Comments