Searching \ for 'Divide by 10' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/method/math.htm?key=divide
Search entire site for: 'Divide by 10'.

Truncated match.
'Divide by 10'
1996\05\29@140451 by

Dudes:

The following is from Pete Brink (pete.brinkmicrochip.com), who is
having trouble posting directly to the list:

------ Forwarded Message Follows -------

Here was my answer to the divide by 10 problem.  It's kind of based
upon how floating point format works, successive divisions by
multiples of two to approximate a multiply.

One solution would be to perform a conversion to a multiple of 16.
That is, (1.6 * X) / 16.  The operation can be done entirely with
shifts and adds.  As a quick approximation I came up with:

(X + (X >> 1) + (X >> 4) + (X >> 5)) >> 4 = X / 10.

This calculation yields (1.59375 * X) / 16 (0.3% error).  You can get
even closer with more shifting, but it rapidly becomes more costly
than a look-up table in run-time processing.

Pete

------ End of Forwarded Message ------

Andrew Warren - fastfwdix.netcom.com
Fast Forward Engineering, Vista, California
http://www.geocities.com/SiliconValley/2499

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...