# Dividing variables

• 06-15-2007, 04:27 PM
frangolfgt
Dividing variables
How do i divide variables in RR? / sign is taken, so what symbol do you use? I am making a fuel log (just a table)

¦ date ¦ litres ¦ p per litre ¦ milage ¦ cost ¦ mpg ¦

variables are called

datef namef pencef lastf nextf interf

Date, litres, p per litre, milage are filled in with the numosk, cost is worked out by multiplying litres by p per litre - this works fine

Code:

`B,549,115,105,28,"BYVAR;VMPAGE;EVAL;VMNEXTF01;\$VMNAMEF01\$*\$VMPENCEF01\$<<EVAL;VMNEXTF01B;\$VMNAMEF01B\$*\$VMPENCEF01B\$",`
I want to get mpg by dividing milage by litres and then dividing this by 4.5. If it was a / sign for divide it would be this (unless i made a mistake).

Code:

`B,655,115,74,28,"BYVAR;VMPAGE;EVAL;VMINTERF01;\$VMLASTF01\$/\$VMNAMEF01\$/\$4.5\$<<EVAL;VMINTERF01B;\$VMLASTF01B\$/\$VMPENCEF01B\$/\$4.5\$",`

Thank you
• 06-16-2007, 12:42 AM
Blue ZX3
To make this much easier, Y don't you just use the Milage trip plugin??

This is what it does, and keeps a log, like the one your trying to do *re-inventing the wheel??

See here, I use it and it works great.

http://www.mp3car.com/vbulletin/rr-p...nsumption.html
• 06-16-2007, 06:30 AM
frangolfgt
I know about that but cant test it it needs gps. I thought it would be simple to do it my way, I just need the divide symbol. Plus ive made the skin and it took ages.
• 06-24-2007, 11:18 PM
frangolfgt
I guess no one know... or will tell me. Still hoping someone can help:confused:
• 06-25-2007, 11:10 AM
Sal R.
Why can't you use "/" ? I did and it works fine.

Here's a line I use it in:
Code:

`"EVALWINAMPVOL","EVAL;evalwinampvolvar;\$TEMPigwinampvol\$*255/100||SETVAR;evalwinampvolvar;\$evalwinampvolvar\$||SAVETOSKIN;evalwinampvolvar;\$evalwinampvolvar\$"`
• 06-26-2007, 11:56 AM
frangolfgt
For some reason it didnt work. Ill try again though.
• 06-29-2007, 10:15 PM
frangolfgt
Ok found the problem... It now works. Thought the problem was because it couldnt use / as divide but it was something else entirely - some variables were named and labeled wrong and my maths was dodgy. LOL. Thanks for making me check again. If anyone wants the code, what it does and what i did with it just ask.
• 07-19-2007, 08:30 PM
frangolfgt
Ok another question - is it possible to limit numbers to 2 dp only? I only need 2 decimal places in my output numbers, any more is pointless.

One gives a cash value for cost, (so obviously more than 2dp gives 10ths of pence - useless)
T
he other gives MPG which only needs 1dp really (it isnt accurate enough to use any more) plus who cares about being something like 0.05 of a MPG out.