Results 1 to 10 of 10

Thread: Integer or Round function with RR

  1. #1
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,868

    Smile Integer or Round function with RR

    I create a value (DFXSPEEDINPERCENT) with an other but i should like to obtain the Round or the Integer of this value.
    Code:
    EVAL;DFXSPEEDINPERCENT;$DFXSPEED$/65535*20
    How can i do that with RR .

    Thanks

  2. #2
    Low Bitrate
    Join Date
    Oct 2010
    Location
    Ivry-Sur-Seine (France)
    Posts
    71
    I think it will you use RREXTENDED PI and the function RNDVAR
    "RndVar;<VALUE TO ROUND>;<NUMBER OF PLACES>;<RESULT VAR>"
    * $MYVAR$ = 15.458468413874
    Example: "RndVar;$MYVAR$;0;RESULT"
    Result: RESULT = 15

  3. #3
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,817
    use \ for integer division: EVAL;DFXSPEEDINPERCENT;$DFXSPEED$/65535*20
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

  4. #4
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,868
    Quote Originally Posted by guino View Post
    use \ for integer division: EVAL;DFXSPEEDINPERCENT;$DFXSPEED$/65535*20
    Like that ?
    EVAL;DFXSPEEDINPERCENT;$DFXSPEED$\65535*20

    My label is that:
    Code:
    L,20,218,300,34,169,197,209,22,"Arial:BI","=$DFXSPEEDINPERCENT$||=%","LEFT",,"DS=2,2,0,0,0"

  5. #5
    Super Moderator
    Auto Apps:loading...
    JohnWPB's Avatar
    Join Date
    Sep 2005
    Location
    West Palm Beach, Florida
    Posts
    4,723
    Blog Entries
    1
    I'm not too sure on that one, I THINK it should be / I have never seen a forward slash used for division..... Even in the example he is using the /, which looks correct.
    Front End of Choice: Ride Runner (Is there anything else??? ) & Powered by the DFX5.1 Skin Available in the Mobile App Mart

    My Fiero Build Thread

  6. #6
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,868
    In fact,
    EVAL;DFXSPEEDINPERCENT;$DFXSPEED$\65535*20 don't run

    So where i use the \ please ?

  7. #7
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,817
    \ is integer division, / is float point division, so you did in fact replace it as I meant you to do (sorry for not replacing it myself on the example), the issue you're probably getting however is the math involved with integer division (if you get any number less than 65535 and do an integer division by 65335 you get ZERO), so try THIS:

    EVAL;DFXSPEEDINPERCENT;($DFXSPEED$*20)\65535

    Alternatively, this should be equivalent to rounding a number:

    EVAL;RESULT;MYFLOATVAR\1

    If MYFLOATVAR = 1.23 then RESULT=1
    If MYFLOATVAR = 1.57 then RESULT=2 (it will get rounded - there are ways to make it not round it off)

    If you use this method you can do all your calculations as usual, then at the end just get the result and round it off.
    Last edited by guino; 10-06-2011 at 03:22 PM.
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

  8. #8
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,868
    Wonderfull Guino,
    I confirm that :
    EVAL;DFXSPEEDINPERCENT;($DFXSPEED$*20)\65535
    give me well an integer result :-)
    I suppose that if i want a result updated each second i must to use a timer ?

  9. #9
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,817
    Unfortunately, yes... I think it's time we add an "EVAL" label code so that you can place complex stuff into labels directly.. we'll have to add a way to allow label codes directly in the expressions though..
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

  10. #10
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,868
    Cool,
    may be for the november release ?

Similar Threads

  1. Budget SSD Round-up
    By Penzance in forum CarPC News
    Replies: 1
    Last Post: 09-10-2010, 06:30 PM
  2. Replies: 3
    Last Post: 10-30-2007, 12:14 AM
  3. FS: 17" ROUND LCD Monitor!! YES, ROUND!!
    By Motorcity in forum Classified Archive
    Replies: 13
    Last Post: 03-31-2006, 10:09 PM
  4. A big round of thank you.
    By Darmie in forum General MP3Car Discussion
    Replies: 2
    Last Post: 03-27-2006, 10:11 AM
  5. Opinions on round two....
    By Psychobiker in forum Fabrication
    Replies: 0
    Last Post: 11-12-2005, 07:01 PM

Bookmarks

Posting Permissions

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