# to the nth power

Brian Adkins adkins at carp.cis.ohio-state.edu
Fri Nov 9 02:23:28 AEST 1990


In article <1990Nov7.020445.12839 at lotus.com> blambert at lotus.UUCP (Brian Lambert) writes:
>>> 	for (y=x,sqrtx=1;y>0;) {ysave = y;y =/ 16;sqrtx =* 4;}
>It's because programs that take up fewer lines of vertical space also
>consume less CPU time.
>Brian Lambert

Mr. Lambert, do you really believe that the following two routines 
consume different amounts of CPU time?

for (y=x,sqrtx=1;y>0;) {
  ysave = y;
  y /= 16;
  sqrtx *= 4;
}

for (y=x,sqrtx=1;y>0;) {ysave = y;y /= 16;sqrtx *= 4;}

Please correct me if I am mistaken, but I believe any compiler will generate
the same code for both of these routines.

Brian Adkins



More information about the Comp.lang.c mailing list