{"action":"created","issue":{"url":"https://api.github.com/repos/mlenser/roll20-character-sheets/issues/46","labels_url":"https://api.github.com/repos/mlenser/roll20-character-sheets/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/mlenser/roll20-character-sheets/issues/46/comments","events_url":"https://api.github.com/repos/mlenser/roll20-character-sheets/issues/46/events","html_url":"https://github.com/mlenser/roll20-character-sheets/pull/46","id":127517711,"number":46,"title":"Reducing broken decimals for 5e_Shaped inventory weights","user":{"login":"azswengineer","id":16773262,"avatar_url":"https://avatars.githubusercontent.com/u/16773262?v=3","gravatar_id":"","url":"https://api.github.com/users/azswengineer","html_url":"https://github.com/azswengineer","followers_url":"https://api.github.com/users/azswengineer/followers","following_url":"https://api.github.com/users/azswengineer/following{/other_user}","gists_url":"https://api.github.com/users/azswengineer/gists{/gist_id}","starred_url":"https://api.github.com/users/azswengineer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azswengineer/subscriptions","organizations_url":"https://api.github.com/users/azswengineer/orgs","repos_url":"https://api.github.com/users/azswengineer/repos","events_url":"https://api.github.com/users/azswengineer/events{/privacy}","received_events_url":"https://api.github.com/users/azswengineer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-19T19:18:58Z","updated_at":"2016-01-22T10:32:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mlenser/roll20-character-sheets/pulls/46","html_url":"https://github.com/mlenser/roll20-character-sheets/pull/46","diff_url":"https://github.com/mlenser/roll20-character-sheets/pull/46.diff","patch_url":"https://github.com/mlenser/roll20-character-sheets/pull/46.patch"},"body":"My players have complained quite a bit about the oddball repeating decimals that pop up in the inventory weights quite regularly.\r\nThe problem occurs because binary cannot represent most common decimals (e.g. 0.3) exactly, so a great many calculations produce oddball results. Simply doing all of the math as integer math in hundredths fixes this issue.\r\nThis patch changes the calculation by multiplying by 100 at the source of the inventory values, keeping coins an integer count until the final calculation, then dividing by 100 at the end.\r\nI hope this significantly reduces the binary fraction errors that currently plague the inventory weight calculation. I haven't thoroughly tested this, but it seems to work in many cases (assuming I transcribed things correctly from the mingled sheet to the source components).\r\nIdeally there would be a more sweeping change to just not use decimals at all, since this still ends up with some weird calculation errors, but it would require some visible changes to the sheet to do the more comprehensive change, and visible changes might cause issues for campaigns using the sheet."},"comment":{"url":"https://api.github.com/repos/mlenser/roll20-character-sheets/issues/comments/173873125","html_url":"https://github.com/mlenser/roll20-character-sheets/pull/46#issuecomment-173873125","issue_url":"https://api.github.com/repos/mlenser/roll20-character-sheets/issues/46","id":173873125,"user":{"login":"mlenser","id":235857,"avatar_url":"https://avatars.githubusercontent.com/u/235857?v=3","gravatar_id":"","url":"https://api.github.com/users/mlenser","html_url":"https://github.com/mlenser","followers_url":"https://api.github.com/users/mlenser/followers","following_url":"https://api.github.com/users/mlenser/following{/other_user}","gists_url":"https://api.github.com/users/mlenser/gists{/gist_id}","starred_url":"https://api.github.com/users/mlenser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlenser/subscriptions","organizations_url":"https://api.github.com/users/mlenser/orgs","repos_url":"https://api.github.com/users/mlenser/repos","events_url":"https://api.github.com/users/mlenser/events{/privacy}","received_events_url":"https://api.github.com/users/mlenser/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T10:32:25Z","updated_at":"2016-01-22T10:32:25Z","body":"Well in js we can round to 2 digits without much problem so it should go away.\r\n\r\nI just left for the weekend, but would love any help. See https://github.com/mlenser/roll20-character-sheets/tree/v3/D%26D_5e_Shaped/precompiled for the latest. Attacks are basically done besides saves and npc stuff.\r\n\r\nCoin calculations are done. I did some armor and inventory calcs, but didn't finish them.\r\n\r\nI still need to work on spells, roll template, resources, class actions, more sheet workers, and probably more.\r\nFeel free to submit a pull request or I can give you my gchat or Skype for more detailed convo."}}