{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/23841","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/23841/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/23841/comments","events_url":"https://api.github.com/repos/rails/rails/issues/23841/events","html_url":"https://github.com/rails/rails/issues/23841","id":135922877,"number":23841,"title":"Inconsistent rounding of #sum method ","user":{"login":"mengxi-liao","id":16822648,"avatar_url":"https://avatars.githubusercontent.com/u/16822648?v=3","gravatar_id":"","url":"https://api.github.com/users/mengxi-liao","html_url":"https://github.com/mengxi-liao","followers_url":"https://api.github.com/users/mengxi-liao/followers","following_url":"https://api.github.com/users/mengxi-liao/following{/other_user}","gists_url":"https://api.github.com/users/mengxi-liao/gists{/gist_id}","starred_url":"https://api.github.com/users/mengxi-liao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengxi-liao/subscriptions","organizations_url":"https://api.github.com/users/mengxi-liao/orgs","repos_url":"https://api.github.com/users/mengxi-liao/repos","events_url":"https://api.github.com/users/mengxi-liao/events{/privacy}","received_events_url":"https://api.github.com/users/mengxi-liao/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activerecord","name":"activerecord","color":"0b02e1"},{"url":"https://api.github.com/repos/rails/rails/labels/stale","name":"stale","color":"444444"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-02-24T01:40:50Z","updated_at":"2016-07-13T15:08:27Z","closed_at":null,"body":"Hi, we are doing a Rails upgrade from 4.2.2 to 4.2.5.1 which made several test cases fail. \r\n\r\nIn one case, it failed because the rounding of the result is not correct. After some investigation, I found for some reason the following two lines of code return different results on Rails 4.2.5.1\r\n\r\n```\r\n(byebug) sum(\"CEIL(`activities`.quantity/60) * 60 / 3600 * `activities`.price\").to_s\r\n\"58.81\"\r\n(byebug) sum(\"CEIL(`activities`.quantity/60) * 60 / 3600 * (`activities`.price)\").to_s\r\n\"58.806\"\r\n```\r\n\r\nThe activities table only have one record with price 3.63 and quantity 16.19, the result should be 58.806\r\n\r\nI try to run the generated sql and both return the correct result 58.806. How #sum handles rounding?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/232385470","html_url":"https://github.com/rails/rails/issues/23841#issuecomment-232385470","issue_url":"https://api.github.com/repos/rails/rails/issues/23841","id":232385470,"user":{"login":"rails-bot","id":7468109,"avatar_url":"https://avatars.githubusercontent.com/u/7468109?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-bot","html_url":"https://github.com/rails-bot","followers_url":"https://api.github.com/users/rails-bot/followers","following_url":"https://api.github.com/users/rails-bot/following{/other_user}","gists_url":"https://api.github.com/users/rails-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-bot/subscriptions","organizations_url":"https://api.github.com/users/rails-bot/orgs","repos_url":"https://api.github.com/users/rails-bot/repos","events_url":"https://api.github.com/users/rails-bot/events{/privacy}","received_events_url":"https://api.github.com/users/rails-bot/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T15:08:27Z","updated_at":"2016-07-13T15:08:27Z","body":"This issue has been automatically marked as stale because it has not been commented on for at least\nthree months.\n\nThe resources of the Rails team are limited, and so we are asking for your help.\n\nIf you can still reproduce this error on the `5-0-stable` branch or on `master`,\nplease reply with all of the information you have about it in order to keep the issue open.\n\nThank you for all your contributions.\n"}}
{"actor":{"display_login":"rails-bot"}}