pbp math help please!!!


Closed Thread
Results 1 to 4 of 4
  1. #1
    houa's Avatar
    houa Guest

    Angry pbp math help please!!!

    for some reason i keep on getting inaccurate readings from the following equations...

    M VAR BYTE
    A VAR word
    B VAR word
    C VAR word
    D VAR word
    W var byte
    HH var word
    weight var byte
    BMIA VAR BYTE
    BMIB VAR BYTE
    BF VAR BYTE

    CALBF:
    B=82/1000
    A=415/100
    C=9842/100
    D=7676/100

    IF (M=1) THEN
    GOsub MALEBF
    Else
    GOsub FEMALEBF
    goto RT
    ENDIF

    MALEBF:
    BFA = (A*WAIST) 'waist(inches)
    BFB = (B*W) 'W=weight(lbs)
    BF = (-C + BFA - BFB)
    BF = BF/W
    BF = BF*100
    return

    FEMALEBF:
    BFA = (A*WAIST)
    BFB = (B*w)
    BF = (-D + BFA - BFB)
    BF = BF/w
    BF = BF*100
    return
    RT:
    BODYFAT = BF
    RETURN
    '
    '
    CALBMI:
    HH=HEIGHT*HEIGHT 'example use 70 inches
    BMIA=WEIGHT
    BMIB=HH
    BMI=WEIGHT/HH
    BMI=BMI*703
    RETURN

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


    Did you find this post helpful? Yes | No

    Wink Rtfm !!!!

    Just read the manual : PBP works with INTEGERS !!!

    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 " !!!
    *****************************************

  3. #3


    Did you find this post helpful? Yes | No

    Talking PBP can't handle floating point math

    Hi,

    PBP can't handle floating point math.
    However, there are work-arounds.

    Go to this link:
    http://www.melabs.com/resources/fp.htm

    Also, do a search of this forum.
    You should get tons of information.
    Floating point is a very "popular" topic.

    I'm sure somebody here will be able to help you.

    Cheers!
    ---> picnaut

  4. #4
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Post Math Link

    HERE'S an excellent write up on using integer math. Hope it helps.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. Math Operations on pbp
    By Jannia04 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th May 2007, 15:33
  3. Another math problem for PBP
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd April 2005, 20:59
  4. Nasty PBP math help ?
    By Martin in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 30th March 2005, 09:46
  5. PBP 16-bit ADC result math
    By sonic in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th March 2005, 14:21

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