> Aaron, thanks for the tip. I had never really looked at fixed point math > before, and was surprised at the simplicity of your example. My application > is to read optical encoders mounted on the two axes of an astronomical > telescope and convert the encoder readings to the celestial coordinates to > which the telescope is pointing. The computational process involves a > 3D transformation matrix and the usual trig manipulations of angles, so > it could indeed be slow using traditional floating point. I need to worry > a little bit about the precision though. I suppose I could use 2 bytes for > the fractional part instead of one as you had done, since I don't think > the magnitude of my numbers ever gets very large.
you can use 'long long' and that'll give you a 64 bit integer *g* most likely, anything > 16bit on palmos is actually done via software (integer operations) as the bus is (correct me if i am wrong), 16 bit on the 68k CPU's it will still be faster :) fixed point is fun - just depends on the precision level you need :) using 8 bytes = 1/256 precision, that basically means... 1/256 = 0.00390625 which, gives you at least two decimal points of precision 1/65536 = 0.0000152587890625 which, gives you four. up to you :) and, nothing stopping you from using 9, 10, 11 :) if you want 3 decimal points, your best bet would be 1/8192 = 0.0001220703125 or 1/4096 = 0.000244140625 or 1/2048 = 0.00048828125 1/1024 = 0.0009765626 i think you get the idea :) --- Aaron Ardiri [EMAIL PROTECTED] CEO - CTO +46 70 656 1143 Mobile Wizardry http://www.mobilewizardry.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
