{"action":"closed","issue":{"url":"https://api.github.com/repos/lionheart/django-pyodbc/issues/31","repository_url":"https://api.github.com/repos/lionheart/django-pyodbc","labels_url":"https://api.github.com/repos/lionheart/django-pyodbc/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/lionheart/django-pyodbc/issues/31/comments","events_url":"https://api.github.com/repos/lionheart/django-pyodbc/issues/31/events","html_url":"https://github.com/lionheart/django-pyodbc/issues/31","id":23926223,"number":31,"title":"DecimalField and Conversion to Float","user":{"login":"jackson0810","id":1502627,"avatar_url":"https://avatars3.githubusercontent.com/u/1502627?v=4","gravatar_id":"","url":"https://api.github.com/users/jackson0810","html_url":"https://github.com/jackson0810","followers_url":"https://api.github.com/users/jackson0810/followers","following_url":"https://api.github.com/users/jackson0810/following{/other_user}","gists_url":"https://api.github.com/users/jackson0810/gists{/gist_id}","starred_url":"https://api.github.com/users/jackson0810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackson0810/subscriptions","organizations_url":"https://api.github.com/users/jackson0810/orgs","repos_url":"https://api.github.com/users/jackson0810/repos","events_url":"https://api.github.com/users/jackson0810/events{/privacy}","received_events_url":"https://api.github.com/users/jackson0810/received_events","type":"User","site_admin":false},"labels":[{"id":824085954,"url":"https://api.github.com/repos/lionheart/django-pyodbc/labels/help%20wanted","name":"help wanted","color":"0e8a16","default":true},{"id":37079561,"url":"https://api.github.com/repos/lionheart/django-pyodbc/labels/question","name":"question","color":"f9d29d","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2013-12-08T16:43:48Z","updated_at":"2018-02-22T18:18:41Z","closed_at":"2018-02-22T18:18:40Z","author_association":"NONE","body":"Hi,\nThis is more of a question that may not be an issue.  In my model I have a DecimalField with max_digits = 20, and decimal_places = 2.  However, when I enter 444444444444444444 I notice the number is being saved as 444444444444444416.  When I looked at the following code (operations.py):\n\n```\ndef value_to_db_decimal(self, value, max_digits, decimal_places):\n        \"\"\"\n        Transform a decimal.Decimal value to an object compatible with what is\n        expected by the backend driver for decimal (numeric) columns.\n        \"\"\"\n        if value is None:\n            return None\n        if isinstance(value, decimal.Decimal):\n            context = decimal.getcontext().copy()\n            context.prec = max_digits\n            return \"%.*f\" % (decimal_places, value.quantize(decimal.Decimal(\".1\") ** decimal_places, context=context))\n        else:\n            return \"%.*f\" % (decimal_places, value)\n```\n\nI notice that the decimal data is being converted to a floating point.  Would you be able to add some clarification as to why this is needed?  I am in no way saying it is wrong.  I am just trying to understand it.\n\nThanks,\nDerrick\n"}}
{"actor":{"display_login":"RossRogers"}}