{"action":"created","issue":{"url":"https://api.github.com/repos/goby-lang/goby/issues/539","repository_url":"https://api.github.com/repos/goby-lang/goby","labels_url":"https://api.github.com/repos/goby-lang/goby/issues/539/labels{/name}","comments_url":"https://api.github.com/repos/goby-lang/goby/issues/539/comments","events_url":"https://api.github.com/repos/goby-lang/goby/issues/539/events","html_url":"https://github.com/goby-lang/goby/pull/539","id":282684209,"number":539,"title":"Add zero-division check","user":{"login":"hachi8833","id":4289625,"avatar_url":"https://avatars2.githubusercontent.com/u/4289625?v=4","gravatar_id":"","url":"https://api.github.com/users/hachi8833","html_url":"https://github.com/hachi8833","followers_url":"https://api.github.com/users/hachi8833/followers","following_url":"https://api.github.com/users/hachi8833/following{/other_user}","gists_url":"https://api.github.com/users/hachi8833/gists{/gist_id}","starred_url":"https://api.github.com/users/hachi8833/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachi8833/subscriptions","organizations_url":"https://api.github.com/users/hachi8833/orgs","repos_url":"https://api.github.com/users/hachi8833/repos","events_url":"https://api.github.com/users/hachi8833/events{/privacy}","received_events_url":"https://api.github.com/users/hachi8833/received_events","type":"User","site_admin":false},"labels":[{"id":639119886,"url":"https://api.github.com/repos/goby-lang/goby/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"hachi8833","id":4289625,"avatar_url":"https://avatars2.githubusercontent.com/u/4289625?v=4","gravatar_id":"","url":"https://api.github.com/users/hachi8833","html_url":"https://github.com/hachi8833","followers_url":"https://api.github.com/users/hachi8833/followers","following_url":"https://api.github.com/users/hachi8833/following{/other_user}","gists_url":"https://api.github.com/users/hachi8833/gists{/gist_id}","starred_url":"https://api.github.com/users/hachi8833/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachi8833/subscriptions","organizations_url":"https://api.github.com/users/hachi8833/orgs","repos_url":"https://api.github.com/users/hachi8833/repos","events_url":"https://api.github.com/users/hachi8833/events{/privacy}","received_events_url":"https://api.github.com/users/hachi8833/received_events","type":"User","site_admin":false},"assignees":[{"login":"hachi8833","id":4289625,"avatar_url":"https://avatars2.githubusercontent.com/u/4289625?v=4","gravatar_id":"","url":"https://api.github.com/users/hachi8833","html_url":"https://github.com/hachi8833","followers_url":"https://api.github.com/users/hachi8833/followers","following_url":"https://api.github.com/users/hachi8833/following{/other_user}","gists_url":"https://api.github.com/users/hachi8833/gists{/gist_id}","starred_url":"https://api.github.com/users/hachi8833/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachi8833/subscriptions","organizations_url":"https://api.github.com/users/hachi8833/orgs","repos_url":"https://api.github.com/users/hachi8833/repos","events_url":"https://api.github.com/users/hachi8833/events{/privacy}","received_events_url":"https://api.github.com/users/hachi8833/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-12-17T10:31:01Z","updated_at":"2017-12-17T14:02:56Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/goby-lang/goby/pulls/539","html_url":"https://github.com/goby-lang/goby/pull/539","diff_url":"https://github.com/goby-lang/goby/pull/539.diff","patch_url":"https://github.com/goby-lang/goby/pull/539.patch"},"body":"I found that zero division has not been checked in numerical operator `/` and '%`.\r\n\r\nAdded zero-division check against `Integer`, `Float`, and `Decimal`\r\n\r\n```ruby\r\n» 6 / 0\r\n#» ZeroDivisionError: Divided by 0\r\n» 6 / -0\r\n#» ZeroDivisionError: Divided by 0\r\n» 6.0 / 0\r\n#» ZeroDivisionError: Divided by 0\r\n» 6.0 / -0\r\n#» ZeroDivisionError: Divided by 0\r\n» \"6.0\".to_d / 0\r\n#» ZeroDivisionError: Divided by 0\r\n» \"6.0\".to_d / -0\r\n#» ZeroDivisionError: Divided by 0\r\n```\r\n\r\nBefore the fix, `Float`'s zero-division like `6.0 / 0` returned `+Inf` as a `Float` class, but the negative zero-division `6.0 / -0` also returned the positive `+Inf`, which is inappropreate. I wondered a bit but finally treated them as ZeroDivisionError.\r\n\r\n---------------\r\n\r\nWell, Ruby's zero-division check is like the following: \r\n\r\n```ruby\r\n1/0          #=> ZeroDivisionError: divided by 0\r\n1/-0         #=> ZeroDivisionError: divided by 0\r\n1/0.0        #=> Infinity\r\n1/-0.0       #=> -Infinity\r\n1/0r         #=> ZeroDivisionError: divided by 0\r\n1/-0r        #=> ZeroDivisionError: divided by 0"},"comment":{"url":"https://api.github.com/repos/goby-lang/goby/issues/comments/352257854","html_url":"https://github.com/goby-lang/goby/pull/539#issuecomment-352257854","issue_url":"https://api.github.com/repos/goby-lang/goby/issues/539","id":352257854,"user":{"login":"st0012","id":5079556,"avatar_url":"https://avatars3.githubusercontent.com/u/5079556?v=4","gravatar_id":"","url":"https://api.github.com/users/st0012","html_url":"https://github.com/st0012","followers_url":"https://api.github.com/users/st0012/followers","following_url":"https://api.github.com/users/st0012/following{/other_user}","gists_url":"https://api.github.com/users/st0012/gists{/gist_id}","starred_url":"https://api.github.com/users/st0012/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st0012/subscriptions","organizations_url":"https://api.github.com/users/st0012/orgs","repos_url":"https://api.github.com/users/st0012/repos","events_url":"https://api.github.com/users/st0012/events{/privacy}","received_events_url":"https://api.github.com/users/st0012/received_events","type":"User","site_admin":false},"created_at":"2017-12-17T14:02:56Z","updated_at":"2017-12-17T14:02:56Z","author_association":"OWNER","body":"@hachi8833 Thanks!"}}
{"actor":{"display_login":"st0012"}}