Smarter way for floating point arithmetic calculations

Perform   division operation prior to multiplication, as division is deductive and multiplication is additive,

ie,
           float var1,var2,var3,var4;
           var1=333333;
           var2=444444;
           var3=222;


           One way:
                   var4=var1*var2/var3;


           Better way:
                  var4=var1*(var2/var3);

No comments:

Post a Comment