Decimal to fraction conversion


Results 1 to 21 of 21

Threaded View

  1. #12
    Join Date
    Dec 2006
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ErnieM View Post
    tico,

    (ignores all the hard feelings going back and fourth)

    As far as your original problem goes, how do you intend to hold a fractional number in memory? PBP only handles integers (sad but true).

    So you are limited to schemes such as working with your values scaled up by say 1,000, so 1/16 would be stored as 62 (1/16 * 1000 and truncated to an integer) and you can divide by 62 to see how many 1/16 pieces it has.
    I thought that I could use the method described in post 2 or 3

    divide say 11.5 to get the following results
    5/16 Vector1
    15/16 Vector2
    1 11/16 Vector3
    2 5/8 Vector4
    3 15/16 Vector5
    5 3/4 Vector6Center
    7 9/16 Vector7
    8 7/8 Vector8
    9 13/16 Vector9
    10 9/16 Vector10
    11 3/16 Vector11

    I was hoping that this is possible to do with PBP, If I am wrong plese let me know. I am going to begin writing some code to do this tommorow.


    opps forgot the formula..... as in excel
    Round ((11.5/2) -((11.5/2)*(0.9)^0.5),3 = 5/16
    I am hoping that PBP can process this type of formula, if not its back to the drawing board
    Last edited by tico; - 26th April 2007 at 23:27. Reason: forgot formula

Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. Help for decimal conversion
    By eva in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2007, 18:20
  3. microns to decimal conversion
    By Rleonard in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2007, 14:37
  4. Decimal to Binary Conversion
    By schlaray in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2006, 14:58
  5. Decimal to binary conversion
    By Demon in forum Code Examples
    Replies: 9
    Last Post: - 25th February 2005, 20:05

Members who have read this thread : 0

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