Fixed point are very similar to integer. The only difference is that each count, instead of representing one unit, represents a fraction of a unit which gives higher resulition. For example, the resolution can bi 1/10 or 1/100 or 1/128 and so on. Typically you want to have resolution of binary fractions such as 1/2, 1/4, 1/8 and so on. When you add or substract FP number just do it the same as integer. When you multiply or divide, you need to correct the factor, for example by shifting (if binary fraction) or dividing (if decimal). Tal > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Mccauley, Daniel H > Sent: Tuesday, June 03, 2003 6:46 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: FIXED POINT Number??? Tips to reduce > Program Size usi ng CCS C > > > Does anyone have an example of how to use a fixed point number? > > It still is very confusing to how this is implemented. > > Thanks > > Dan > > > > > > So is that basically like taking a LONG INT (0-62536 or > > whatever it is) > > > and > > > making it: > > > > > > 0 to 62.536 > > > or > > > 0 to 625.36 etc...???? > > > > > > Is that basically all one is doing here??? > > > > > > Thanks > > > Dan > > > > > Nearly. You wouldn't normaly have the fixed points as > decimal as it > > brings back a lot of the overhead. Simply assign a fixed number of > > low order bits > > for your fractional part and the rest for the integer part. > > This way all > > you need to do is to mask and shift in order to obtain fixed > > and fractional > > parts. You can then simply use normal integer math functions. > > > > Regards > > > > Mike > > > > > > ============================================================== > > ========= > > This e-mail is intended for the person it is addressed to only. The > > information contained in it may be confidential and/or protected by > > law. If you are not the intended recipient of this message, > you must > > not make any use of this information, or copy or show it to any > > person. Please contact us immediately to tell us that you have > > received this e-mail, and return the original to us. Any use, > > forwarding, printing or copying of this message is strictly > > prohibited. No part of this message can be considered a request for > > goods or services. > > ============================================================== > > ========= > > Any questions about Bookham's E-Mail service should be > > directed to postmaster@bookham.com. > > > > -- > > http://www.piclist.com hint: The PICList is archived three > different > > ways. See http://www.piclist.com/#archives for details. > > > > -- > http://www.piclist.com hint: The PICList is archived three > different ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.