floating point numbers


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2007
    Posts
    15

    Default floating point numbers

    i need to get a floating point numbers for a speed measurement to ensure accuarcy. Currently i have metres/hundreth which needs to be converted into mph. therefore i need a float number which pbp cant handle. any ideas would be greatfully appreciated.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    no you NEVER EVER need ANY float, and YOU DON'T want to use ANY float anyway.

    I already heard..."huh using float.. what's the point?" and i really laugh... "point" in french is dot... so translate it the way you want, you should understand what i mean Simple multiplication by 100, 100 or 10000 will solve most see all problem.. the dot is just visual effect you can override it easy using DEG, DIG and whatever else if you really need to DISPLAY it

    Float point routine are just slow and code hungry for nothing... forget about it.

    <hr>
    http://en.wikipedia.org/wiki/Floating_point
    http://www.cs.princeton.edu/introcs/91float/

    <hr>
    What's your actual value range you need to change to mph?

    Which version of PBP do you have?
    Last edited by mister_e; - 4th April 2008 at 23:38.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Talking

    Hi, Steve

    NO FP needed ...

    1 Mile = 1619/1006 Km w. Zero error
    1 Mile = 758 / 471 Km w. 1.35 ppm error
    1 Mile = 103 / 64 Km w. 19.3 ppm error

    my favourite :

    Km = Mile */ 412

    Best of ALL

    RTFM , last edition, $ 4.17.1 p.35 ...

    " if you wish to convert miles to kilometers ... etc,etc ..."

    Alain

    PS: What about THAT ???

    http://www.miscel.dk/MiscEl/miscelIntegerMath.html

    http://www.miscel.dk/MiscEl/miscel.html

    Just to be downloaded ... no ???
    Last edited by Acetronics2; - 5th April 2008 at 17:37.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Aug 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    for example if i want to do a calculation 80/2.74 = 29.1971

    how would i go about doing this to get the 29.1971 value. i could times up the 80 by 100 but i cant go above 65535 since that is the size of a word. Any ideas on how to get the value of 29.197 so i can times it by a conversion rate?

  5. #5
    Join Date
    Aug 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    if i do

    x = 2560/153

    x should = 16.73..... but pbp will see it as 16. therefore i wanted to use the remainder function to get the 0.7


    remainder = 2560 // 153

    but when i print it out on an lcd it says that the remainder is 0. Why is 7 not stored ?


    Thanks

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I see some several ways... which PBP version, which PIC?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Aug 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    its a pic16f77

    pbp version 2.3.0.0 and

    mplab ide v7.60

    many thanks

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Talking

    V2.30 with 16F77 ...

    might provide interesting moments ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    V2.30 with 16F77 ...
    might provide interesting moments ...
    PBP 2.50a upgrade....only $25....

    How much says the O/P can't get it?

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Well Alain is right this device is not supported in this version... pretty old one i have to say

    Really worth to upgrade everything you have on hand.

    MPLAB is free and now V8.xx
    PBP: now V2.50
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    948


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Alain

    Thank you very much for pointing to this very useful utility.

    Jerson

Similar Threads

  1. Getting out of floating point
    By jcb344 in forum General
    Replies: 3
    Last Post: - 5th August 2008, 21:18
  2. Floating Point Display Problem (serial string out)
    By Cash Olsen in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th December 2007, 02:03
  3. ADCin and floating point values
    By niknaksbarbeque in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th May 2005, 11:38
  4. Floating Point
    By jrudd in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th May 2005, 14:19
  5. DIV32 instead of floating point routines?
    By Tomasm in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd April 2004, 07:50

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