Kerry Wentworth wrote: > Do you have a math library of some sort to do 10.6 arithmetic? Not specifically. I do have various 32 bit math routines for PICs. The advantage of fixed point is that for much of the processing you can treat the numbers as integers. The machine just does the add, only you kno= w that you consider the least significant 6 bits to be fraction bits. > For example, a 1/2 scale left justified A/D reading would be > > 1000 0000 00.00 0000 > and 1/16 would be > 0000 0000 00.00 0100 Yes. > The desired result is 0000 1000 00.00 0000 Assuming you want to multiply the two numbers, which you didn't say. > Doing a binary multiply would result in a value of 0. No. I don't see how you get that no matter how you think multiply works. If you just multiply fixed point numbers together as if they were integers, then the result has the total number of fraction bits in both the input numbers, which in this example is 12. The result of a straight integer multiply without any prescaling would be: 1000000000.000000 x 0000000000.000100 ------------------- 00000000100000000000.000000000000 Again, the fact that you consider these numbers to have a binary point somewhere in the middle is totally on your end. The processor just does integer arithmetic. > On the other hand, a 1/2 scale right justified A/D reading would be > 0000 0010 00.00 0000 That doesn't make sense. If you are using right justified A/D readings, then they would be integers. I don't see where the fraction bits are supposed to come from in this case. > Please pardon my ignorance, I'm here to learn. Is 10.6 arithmetic > something that everybody but me uses? Is it an assembly language > thing? Fixed point in general is commonly used on small systems like PICs. 10.6 format is just one example, which has 6 fraction bits in a 16 bit number. Fixed point is common when you need to represent fractional values but have a integer arithmetic processor. It's more tricky than floating point because you have to keep track of where the imagined binary point is. One way to think of floating point is that it stores the binary point information in the number, and updates everything accordingly at run time. That takes more hardware, which small processors like PICs don't have. > I use a C compiler almost exclusively. There's the problem. Wake up and smell the bits. It is difficult to understand what is really going on if you keep a compiler between you and what is really going on. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .