On 24/11/2010 16:22, Olin Lathrop wrote: > Kerry Wentworth wrote: > >> 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 ha= ve > 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. > > > * Other common option are 8.8 if only 8 bit "final" values are needed, as=20 then the higher byte is the Integer. The compiler is irrelevant. You are just using 16 bit integers. You only have to think about the dp location after a multiply. Since an=20 Integer multiplication results in twice the bits on answer, you have to=20 think about that anyway. (maybe in C cast the input values to 32bits=20 from 16bit sized type before you multiply or it will overflow). Where the DP is placed is application dependent. All the existing=20 Integer libraries work. You just may rescale by packing or dropping a=20 byte, or Left or right shifts before calling the existing math routines=20 or after calling them. Maths done with paper and pen of currency is example of fixed point=20 integer. Infact most long hand on paper fixed decimal length maths is=20 not Floating point but simply Integer. It's really nothing magical, but=20 pre-calculator Primary School maths. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .