I am trying to optimize repeated math operations. If I have

UInt16  x, y;

and need to divide x by 100. Is it easier on the CPU to write

y = x / 100;

than

y = x * 0.01;

I am assuming the former does an integer division, while the latter does a 
floating-point multiplication, and that any floating-point operation takes 
longer than an integer operation. Am I right?

Lastly, if I write

y = x / 100.0;

will the OS perform a floating-point division because of the 100.0, or will it 
perform an integer division because both x and y are integers?


Luc Le Blanc
-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to