Picbasic Pro divide problem


Results 1 to 8 of 8

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Picbasic Pro divide problem

    Hi Hebemabo,

    You can get the same results with ...
    Code:
    circ = puls ** 28922 + R2.15
    Dividing fractional numbers is fairly difficult.
    But multiplying them is easy.

    Dividing by 2.266 is the same as multiplying times 0.44130626654898499558693733451015 ... (1/2.266)
    And you can do that with the ** operator.

    Multiply 0.44130626654898499558693733451015 * 65536 and you get 28922 rounded up.

    The ** operator is essentially a multiply with an implied /65536.
    So puls * 28922 / 65536 is the same as puls / 2.266.

    The R2.15 takes the high bit of the low word from the multiplication.
    It acts the same as your "round to 1mm".
    Last edited by Darrel Taylor; - 6th November 2011 at 21:10.
    DT

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts