piclist 2001\04\05\111851a >
Thread: clever rounding out there ?
face BY : Roman Black email (remove spam text)

Bob Ammerman wrote:

{Quote hidden}

Excellent work Bob! So, it would take about:

1. add 25 to the 24bit number. (6)
2. extract the 10s and 1s digits. (68)
3. if 10s is greater than 5 subtract 5 from it. (7)
4. multiply 10s by 10 (simple lookup table, 5 bytes) (5)
5. add 1s to 10s (this is now the 50 modulus) (2)
6. subtract the modulus from the 24bit number (6)

That's only about 94 instructions, give or take
a few. :o)

So that would be on a 18C series PIC, how much
larger would it become if using only a 16 series
PIC I wonder??

http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listserv@spam@spamspammitvma.mit.edu with SET PICList DIGEST in the body

<3ACC8C88.3C6D@ezy.net.au> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) clever rounding out there ?

month overview.

new search...