piclist 2017\09\06\115921a >
Thread: Division routines.
picon face BY : Walter Banks email (remove spam text)

I depends how much you know about the numbers. This works as long as the
MSbit of x is 0.
No magic in this and not particularly fast.


// divide x/y and return a fraction
// x < y always
// reference in 16 bits

uint16_t div_fract (uint16_t x,y)
    char count = 16 ; // size of result in bits
      x <<= 1;
      if (x >= y)
         x -= y;
         x |= 1;
   return x;

http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
<8accdb9a-51a1-ac1d-b1e0-77bd70cc4325@bytecraft.com> base64

In reply to: <CAFo_nNrrP-pkzd4t+65LLLrq7hj=EB8z6yKgLKyEGnjBaHtjtw@mail.gmail.com>
See also: www.piclist.com/techref/microchip/math/index.htm?key=division
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) Division routines.

month overview.

new search...