Path: chuka.playstation.co.uk!news From: "Jon Prestidge (alias Moose)" Newsgroups: scee.yaroze.programming.codewarrior Subject: "No FP... no comment" Date: 15 Aug 1997 14:21:17 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 37 Message-ID: <01bca987$927743a0$e6567ec2@default> NNTP-Posting-Host: client86e6.globalnet.co.uk X-Newsreader: Microsoft Internet News 4.70.1155 If Codewarrior does not support floating-point guff, how do I do a square-root. It's OK not supporting FP (I suppose it makes sure you use more efficient integer stuff) provided there are a few integer function equivelents to replace things like pow. Does anyone know how to effect a square-root using integer maths??? In particular I'm trying to get this ScaleUnitToVector routine to work.... the squared things are easy enough because I can just multiply them by themselves but what do I do about the 'length = pow(square, 0.5);' line ... if anyones got any suggestions I'd be most greatful! Sounds like Micheal in the above item "problems with sin()" has a similar problem with the sin function...... what is to be done??? Jon void ScaleVectorToUnit (VECTOR* vector) { int length, square; square = pow(vector->vx, 2) + pow(vector->vy, 2) + pow(vector->vz, 2); length = pow(square, 0.5); assert(length != 0); // never allow division by zero vector->vx *= ONE; vector->vy *= ONE; vector->vz *= ONE; vector->vx /= length; vector->vy /= length; vector->vz /= length; }