piclist 2017\09\06\130811a >
Thread: Division routines.
www.piclist.com/techref/microchip/math/index.htm?key=division
flavicon
face BY : smplx email (remove spam text)





On Tue, 5 Sep 2017, smplx wrote:

enhancement to my own code follows

> int frac_div(int x, int y)
> {
>        // divide x by y where x is always <= y
>        // x and y are always positive

       // where x is always < y
         // x and y are always positive
       x = x << 1;

{Quote hidden}

       // results is now 16 bit binary fraction with
       // binary point before the MSB

>
>        return res;
> }


Regards
Sergio Masci
-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

<alpine.LNX.2.00.1709061907200.25052@tin.allotrope.net> quoted-printable

In reply to: <alpine.LNX.2.00.1709052121550.17067@tin.allotrope.net>
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...