From: murray AT southeast DOT net (Murray Stokely) Newsgroups: comp.os.msdos.djgpp Subject: Fixed Point (Optimization) Date: Fri, 03 Jan 1997 20:31:53 GMT Organization: ACiD Productions Lines: 40 Message-ID: <32cd6b2c.4726585@nntp.southeast.net> Reply-To: murray AT southeast DOT net NNTP-Posting-Host: ts4-025.southeast.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Is Fixed-Point math still a neccesity for today's computers with all their built it FPU's, etc? How much faster can it be? Anyway, this is the same code procedure from our long thread on optimization; I've recently come back to it, because I still see room for improvement. What can be done to it. Fixed point? Lookup tables? void calculate_tfm(int diameter, char magnification) { int a,b,x,y,z,s,x2,y2; int radius,r2; z=0; radius=diameter/2; s=round(sqrt(abs((radius-magnification) * (radius+magnification)))); s=s*s; r2=radius*radius; for(y=-radius;y= s) { a=x; b=y; } else { z=round(sqrt(r2-x2-y2)); a=round(x*magnification/z); b=round(y*magnification/z); } tfm[(y+radius)*diameter+(x+radius)]=(b+radius)*diameter+(a+radius); } // end of for x } // end of for y } Murray Stokely ( murray AT southeast DOT net ) http://www.cdrom.com/pub/artpacks