I agree with all that has been said. But....... Because the maximum results is only 7 bits, I would use 9 bits for the fraction (16355, 1635, 163). And then just divide the high order result byte by 2. Bill ----- Original Message ----- From: "Olin Lathrop" To: Sent: Friday, July 05, 2002 8:47 AM Subject: Re: [PIC]: Rounding the result of a floating point multiplication > I deliberately didn't add 1/2 LSB. Note that my scale factor was based on > 115/360, not 114/359 as most others were (incorrectly). With this mapping > you get the right answer by truncating, not rounding. This maps the ranges > correctly but still guarantees that the maximum input value won't round up > to the maximum output value + 1. > > You may have a point about rounding the scale factors instead of truncating > them. I didn't feel like doing the analisys to make sure that rounding them > would guarantee that the result could never be >114, so I just truncated > them. (I also didn't think anyone would look carefully enough to even > notice). Since we have 8 fraction bits the resulting error is very small. > The result would have to be within a tiny fraction of an LSB of a decision > threshold to cause the lower number to be picked when the "right" answer is > the higher. > > > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com > > -- -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu