{"action":"created","issue":{"url":"https://api.github.com/repos/influxdata/influxdb/issues/5938","repository_url":"https://api.github.com/repos/influxdata/influxdb","labels_url":"https://api.github.com/repos/influxdata/influxdb/issues/5938/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/influxdb/issues/5938/comments","events_url":"https://api.github.com/repos/influxdata/influxdb/issues/5938/events","html_url":"https://github.com/influxdata/influxdb/issues/5938","id":139338082,"number":5938,"title":"[bug] Discrepancies in SUM and MEAN query results","user":{"login":"kostasb","id":15780449,"avatar_url":"https://avatars.githubusercontent.com/u/15780449?v=3","gravatar_id":"","url":"https://api.github.com/users/kostasb","html_url":"https://github.com/kostasb","followers_url":"https://api.github.com/users/kostasb/followers","following_url":"https://api.github.com/users/kostasb/following{/other_user}","gists_url":"https://api.github.com/users/kostasb/gists{/gist_id}","starred_url":"https://api.github.com/users/kostasb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kostasb/subscriptions","organizations_url":"https://api.github.com/users/kostasb/orgs","repos_url":"https://api.github.com/users/kostasb/repos","events_url":"https://api.github.com/users/kostasb/events{/privacy}","received_events_url":"https://api.github.com/users/kostasb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-08T17:16:46Z","updated_at":"2016-03-09T17:40:15Z","closed_at":null,"body":"After a random number of iterations executing the same SUM or MEAN query, different results are returned at the lower floating point digits with v0.11 master branch.\r\n\r\nE.g.\r\n\r\nUsing sample dataset NOAA (https://s3-us-west-1.amazonaws.com/noaa.water.database.0.9/NOAA_data.txt)\r\n\r\nSUM value calculated with Python is: 67777.66900000008\r\nselect sum(water_level) from h2o_feet\r\nFirst 4 iterations match with the pre-calculated value. 5th iteration:\r\nValueError: Iteration 5: Sum(water_level) = 67777.66900000024 did not match 67777.66900000008\r\n\r\n15 digit accuracy MEAN value calculated with Python is: 4.442107025822525\r\nselect mean(water_level) from h2o_feet\r\nFirst 3 iterations match with the pre-calculated value. 4th iteration:\r\nValueError: Iteration 4: Mean(water_level) = 4.442107025822535 did not match 4.442107025822525\r\n\r\nWe have integration test cases that we can run to reproduce the issue easily.\r\n\r\n@jsternberg @e-dard @joelegasse thoughts?"},"comment":{"url":"https://api.github.com/repos/influxdata/influxdb/issues/comments/194417798","html_url":"https://github.com/influxdata/influxdb/issues/5938#issuecomment-194417798","issue_url":"https://api.github.com/repos/influxdata/influxdb/issues/5938","id":194417798,"user":{"login":"joelegasse","id":1391698,"avatar_url":"https://avatars.githubusercontent.com/u/1391698?v=3","gravatar_id":"","url":"https://api.github.com/users/joelegasse","html_url":"https://github.com/joelegasse","followers_url":"https://api.github.com/users/joelegasse/followers","following_url":"https://api.github.com/users/joelegasse/following{/other_user}","gists_url":"https://api.github.com/users/joelegasse/gists{/gist_id}","starred_url":"https://api.github.com/users/joelegasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelegasse/subscriptions","organizations_url":"https://api.github.com/users/joelegasse/orgs","repos_url":"https://api.github.com/users/joelegasse/repos","events_url":"https://api.github.com/users/joelegasse/events{/privacy}","received_events_url":"https://api.github.com/users/joelegasse/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T17:40:15Z","updated_at":"2016-03-09T17:40:15Z","body":"I don't understand how it is misleading. I think @jsternberg has the right idea in that we should just educate people that the value `0.1` can never be stored exactly as a floating point value, and that InfluxDB makes no guarantees about the order of operations for aggregate functions. All of the aggregate values calculated (other than when using `math/big`) in the above example are technically incorrect.\r\n\r\nI don't think adding a more precise floating point or decimal value type will have a significant benefit, but that's a larger discussion, and not really related to aggregate functions currently returning slightly different values."}}