Rounding errors - Fuelly Forums

Click here to see important news regarding the aCar App

Reply
 
Thread Tools Display Modes
 
Old 11-17-2010, 08:54 PM   #1
Registered Member
 
Join Date: Nov 2010
Posts: 13
Country: United Kingdom
Location: Birmingham
Rounding errors

I've imported my data on both the car's I've owned. I am proud to tell you that I have recorded every fuel filling I've ever done in my life. I think this is just the site for me!

However there are rounding errors. These are present when I export the data. Eg I import a filling of 37.000 litres, but it appears in "Basic stats" as 36.999 litres. It appears in the full log as "37.0" litres. If I Export the data, it comes out as 36.999 litres. :-(

Is it being stored in a table without enough precision, and/or is there a set of unnecessary conversion to gallons and back? If so please can this be set more accurately?

Even if I edit the fuelup and set it to 37.000, it immediately gets set back to 36.999.
__________________

mrtickle is offline   Reply With Quote
Old 11-18-2010, 02:01 AM   #2
pb
Senior Member
 
Join Date: Jul 2008
Posts: 1,588
Country: United States
Location: Corvallis, OR
You're right, Fuelly stores everything in US units. We do this so we can convert between US, Metric, and UK units for display. One side-effect of conversion is that we lose precision in exactly this way.

Changing this around would mean a complete rewrite of the system, and we're not willing to do that. If you report your fuel-ups in litres or kilometers and you need absolute precision I'm afraid Fuelly isn't going to work for you. You'll need to find a system that stores data in litres and kilometers.
__________________

pb is offline   Reply With Quote
Old 11-18-2010, 04:16 AM   #3
Registered Member
 
Join Date: Nov 2010
Posts: 13
Country: United Kingdom
Location: Birmingham
Fair enough. I completely understand why you did that and didn't mean to tread on any toes. Obviously asking to completely rewrite the system isn't reasonable of me and I wouldn't do that, especially on my first day :-)

Having thought about it more, I think that storing the converted US gallons value with a bit more precision - even just 1 or 2 more decimal places - might do the trick. Doing a test in Excel with the "precision as displayed" option turned on you can test converting from litres to US gallons and then back to litres, and then a separate "rounded to 3dp" copy of the litres output value. You can see the effect it has when changing the number of decimal places used to store the US gallons value.

When I use 3dp to store the US gallons value I get the .999 behaviour for the litres output, but with 4dp it seems to be ok! Even though the raw converted litres value isn't bang on, this doesn't really matter because when it is rounded to 3dp as it would be for display, it matches the original value.

something like...

conv factor=3.785411784

input litres=38

US gallons stored to 4dp=10.0385

output litres=37.9998562

display litres (3dp)=38.000

Again, I apologise in advance if this is asking too much but it might turn out to be possible to get the litres display correct with small changes. :-)
mrtickle is offline   Reply With Quote
Old 11-18-2010, 04:40 AM   #4
pb
Senior Member
 
Join Date: Jul 2008
Posts: 1,588
Country: United States
Location: Corvallis, OR
huh, hadn't considered that as a fix. I'll do some testing and see if I get similar results with our database.
pb is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


» Fuelly Android Apps
No Threads to Display.
Powered by vBadvanced CMPS v3.2.3


All times are GMT -8. The time now is 10:44 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.