{"action":"created","comment":{"url":"https://api.github.com/repos/sympy/sympy/pulls/comments/31442835","id":31442835,"diff_hunk":"@@ -220,3 +220,72 @@ def __ge__(self, other):\n         if self.args[0] == other and other.is_real:\n             return S.true\n         return Ge(self, other, evaluate=False)\n+\n+\n+class frac(Function):\n+    r\"\"\"Represents the fractional part of x\n+\n+    For real numbers it is defined [1]_ as\n+\n+    .. math::\n+        x - \\lfloor{x}\\rfloor\n+\n+    Examples\n+    ========\n+\n+    >>> from sympy import Symbol, frac, Rational, floor, ceiling, I\n+    >>> frac(Rational(4, 3))\n+    1/3\n+    >>> frac(-Rational(4, 3))\n+    2/3\n+\n+    returns zero for integer arguments\n+\n+    >>> n = Symbol('n', integer=True)\n+    >>> frac(n)\n+    0\n+\n+    rewrite as floor\n+\n+    >>> x = Symbol('x')\n+    >>> frac(x).rewrite(floor)\n+    x - floor(x)\n+\n+    for complex arguments\n+\n+    >>> r = Symbol('r', real=True)\n+    >>> frac(I*r)\n+    I*frac(r)\n+\n+    See Also\n+    ========\n+\n+    sympy.functions.elementary.integers.floor\n+    sympy.functions.elementary.integers.ceiling\n+\n+    References\n+    ===========\n+\n+    .. [1] http://en.wikipedia.org/wiki/Fractional_part\n+    .. [2] http://mathworld.wolfram.com/FractionalPart.html\n+\n+    \"\"\"\n+    @classmethod\n+    def eval(cls, arg):\n+        from sympy import im\n+        if arg.is_integer:\n+            return S.Zero\n+        if arg.is_imaginary or (S.ImaginaryUnit*arg).is_real:","path":"sympy/functions/elementary/integers.py","position":59,"original_position":59,"commit_id":"717a236a49944b674f4ce7270d1bbfca254067a0","original_commit_id":"717a236a49944b674f4ce7270d1bbfca254067a0","user":{"login":"leosartaj","id":6217976,"avatar_url":"https://avatars.githubusercontent.com/u/6217976?v=3","gravatar_id":"","url":"https://api.github.com/users/leosartaj","html_url":"https://github.com/leosartaj","followers_url":"https://api.github.com/users/leosartaj/followers","following_url":"https://api.github.com/users/leosartaj/following{/other_user}","gists_url":"https://api.github.com/users/leosartaj/gists{/gist_id}","starred_url":"https://api.github.com/users/leosartaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leosartaj/subscriptions","organizations_url":"https://api.github.com/users/leosartaj/orgs","repos_url":"https://api.github.com/users/leosartaj/repos","events_url":"https://api.github.com/users/leosartaj/events{/privacy}","received_events_url":"https://api.github.com/users/leosartaj/received_events","type":"User","site_admin":false},"body":"I will update the code with a comment.","created_at":"2015-06-01T16:28:04Z","updated_at":"2015-06-01T16:28:04Z","html_url":"https://github.com/sympy/sympy/pull/9342#discussion_r31442835","pull_request_url":"https://api.github.com/repos/sympy/sympy/pulls/9342","_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/31442835"},"html":{"href":"https://github.com/sympy/sympy/pull/9342#discussion_r31442835"},"pull_request":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9342"}}},"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/9342","id":34023902,"html_url":"https://github.com/sympy/sympy/pull/9342","diff_url":"https://github.com/sympy/sympy/pull/9342.diff","patch_url":"https://github.com/sympy/sympy/pull/9342.patch","issue_url":"https://api.github.com/repos/sympy/sympy/issues/9342","number":9342,"state":"open","locked":false,"title":"Implemented fractional part function","user":{"login":"leosartaj","id":6217976,"avatar_url":"https://avatars.githubusercontent.com/u/6217976?v=3","gravatar_id":"","url":"https://api.github.com/users/leosartaj","html_url":"https://github.com/leosartaj","followers_url":"https://api.github.com/users/leosartaj/followers","following_url":"https://api.github.com/users/leosartaj/following{/other_user}","gists_url":"https://api.github.com/users/leosartaj/gists{/gist_id}","starred_url":"https://api.github.com/users/leosartaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leosartaj/subscriptions","organizations_url":"https://api.github.com/users/leosartaj/orgs","repos_url":"https://api.github.com/users/leosartaj/repos","events_url":"https://api.github.com/users/leosartaj/events{/privacy}","received_events_url":"https://api.github.com/users/leosartaj/received_events","type":"User","site_admin":false},"body":"```\r\n>>> from sympy import frac, Rational, floor\r\n>>> from sympy.abc import x, n\r\n>>> frac(x)\r\nfrac(x)\r\n```\r\nreturns zero for integer arguments\r\n```\r\n>>> frac(n)\r\n0\r\n>>> frac(Rational(8, 5))\r\nRational(3, 5)\r\n```\r\nrewrite as floor\r\n```\r\n>>> frac(x).rewrite(floor)\r\nx - floor(x)\r\n```\r\n\r\ncloses #8674 \r\n@jksuom @debugger22","created_at":"2015-04-24T07:15:53Z","updated_at":"2015-06-01T16:28:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc68277531c075cc390ea5d23da4b3977d4f26fe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sympy/sympy/pulls/9342/commits","review_comments_url":"https://api.github.com/repos/sympy/sympy/pulls/9342/comments","review_comment_url":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/9342/comments","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/717a236a49944b674f4ce7270d1bbfca254067a0","head":{"label":"leosartaj:frac","ref":"frac","sha":"717a236a49944b674f4ce7270d1bbfca254067a0","user":{"login":"leosartaj","id":6217976,"avatar_url":"https://avatars.githubusercontent.com/u/6217976?v=3","gravatar_id":"","url":"https://api.github.com/users/leosartaj","html_url":"https://github.com/leosartaj","followers_url":"https://api.github.com/users/leosartaj/followers","following_url":"https://api.github.com/users/leosartaj/following{/other_user}","gists_url":"https://api.github.com/users/leosartaj/gists{/gist_id}","starred_url":"https://api.github.com/users/leosartaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leosartaj/subscriptions","organizations_url":"https://api.github.com/users/leosartaj/orgs","repos_url":"https://api.github.com/users/leosartaj/repos","events_url":"https://api.github.com/users/leosartaj/events{/privacy}","received_events_url":"https://api.github.com/users/leosartaj/received_events","type":"User","site_admin":false},"repo":{"id":29408196,"name":"sympy","full_name":"leosartaj/sympy","owner":{"login":"leosartaj","id":6217976,"avatar_url":"https://avatars.githubusercontent.com/u/6217976?v=3","gravatar_id":"","url":"https://api.github.com/users/leosartaj","html_url":"https://github.com/leosartaj","followers_url":"https://api.github.com/users/leosartaj/followers","following_url":"https://api.github.com/users/leosartaj/following{/other_user}","gists_url":"https://api.github.com/users/leosartaj/gists{/gist_id}","starred_url":"https://api.github.com/users/leosartaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leosartaj/subscriptions","organizations_url":"https://api.github.com/users/leosartaj/orgs","repos_url":"https://api.github.com/users/leosartaj/repos","events_url":"https://api.github.com/users/leosartaj/events{/privacy}","received_events_url":"https://api.github.com/users/leosartaj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leosartaj/sympy","description":"A computer algebra system written in pure Python","fork":true,"url":"https://api.github.com/repos/leosartaj/sympy","forks_url":"https://api.github.com/repos/leosartaj/sympy/forks","keys_url":"https://api.github.com/repos/leosartaj/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leosartaj/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leosartaj/sympy/teams","hooks_url":"https://api.github.com/repos/leosartaj/sympy/hooks","issue_events_url":"https://api.github.com/repos/leosartaj/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/leosartaj/sympy/events","assignees_url":"https://api.github.com/repos/leosartaj/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/leosartaj/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/leosartaj/sympy/tags","blobs_url":"https://api.github.com/repos/leosartaj/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leosartaj/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leosartaj/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/leosartaj/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leosartaj/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/leosartaj/sympy/languages","stargazers_url":"https://api.github.com/repos/leosartaj/sympy/stargazers","contributors_url":"https://api.github.com/repos/leosartaj/sympy/contributors","subscribers_url":"https://api.github.com/repos/leosartaj/sympy/subscribers","subscription_url":"https://api.github.com/repos/leosartaj/sympy/subscription","commits_url":"https://api.github.com/repos/leosartaj/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/leosartaj/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/leosartaj/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/leosartaj/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/leosartaj/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/leosartaj/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leosartaj/sympy/merges","archive_url":"https://api.github.com/repos/leosartaj/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leosartaj/sympy/downloads","issues_url":"https://api.github.com/repos/leosartaj/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/leosartaj/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/leosartaj/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/leosartaj/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leosartaj/sympy/labels{/name}","releases_url":"https://api.github.com/repos/leosartaj/sympy/releases{/id}","created_at":"2015-01-17T22:39:40Z","updated_at":"2015-05-26T14:11:50Z","pushed_at":"2015-06-01T00:58:49Z","git_url":"git://github.com/leosartaj/sympy.git","ssh_url":"git@github.com:leosartaj/sympy.git","clone_url":"https://github.com/leosartaj/sympy.git","svn_url":"https://github.com/leosartaj/sympy","homepage":"http://sympy.org/","size":69633,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"sympy:master","ref":"master","sha":"f8e6e710480a7d31e00e27f1e20785c1ec288bb7","user":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"repo":{"id":640534,"name":"sympy","full_name":"sympy/sympy","owner":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sympy/sympy","description":"A computer algebra system written in pure Python","fork":false,"url":"https://api.github.com/repos/sympy/sympy","forks_url":"https://api.github.com/repos/sympy/sympy/forks","keys_url":"https://api.github.com/repos/sympy/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sympy/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sympy/sympy/teams","hooks_url":"https://api.github.com/repos/sympy/sympy/hooks","issue_events_url":"https://api.github.com/repos/sympy/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/sympy/sympy/events","assignees_url":"https://api.github.com/repos/sympy/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/sympy/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/sympy/sympy/tags","blobs_url":"https://api.github.com/repos/sympy/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sympy/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sympy/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sympy/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/sympy/sympy/languages","stargazers_url":"https://api.github.com/repos/sympy/sympy/stargazers","contributors_url":"https://api.github.com/repos/sympy/sympy/contributors","subscribers_url":"https://api.github.com/repos/sympy/sympy/subscribers","subscription_url":"https://api.github.com/repos/sympy/sympy/subscription","commits_url":"https://api.github.com/repos/sympy/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sympy/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sympy/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sympy/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sympy/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/sympy/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sympy/sympy/merges","archive_url":"https://api.github.com/repos/sympy/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sympy/sympy/downloads","issues_url":"https://api.github.com/repos/sympy/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/sympy/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/sympy/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/sympy/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sympy/sympy/labels{/name}","releases_url":"https://api.github.com/repos/sympy/sympy/releases{/id}","created_at":"2010-04-30T20:37:14Z","updated_at":"2015-06-01T07:28:26Z","pushed_at":"2015-06-01T08:37:15Z","git_url":"git://github.com/sympy/sympy.git","ssh_url":"git@github.com:sympy/sympy.git","clone_url":"https://github.com/sympy/sympy.git","svn_url":"https://github.com/sympy/sympy","homepage":"http://sympy.org/","size":155690,"stargazers_count":2166,"watchers_count":2166,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1067,"mirror_url":null,"open_issues_count":1908,"forks":1067,"open_issues":1908,"watchers":2166,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9342"},"html":{"href":"https://github.com/sympy/sympy/pull/9342"},"issue":{"href":"https://api.github.com/repos/sympy/sympy/issues/9342"},"comments":{"href":"https://api.github.com/repos/sympy/sympy/issues/9342/comments"},"review_comments":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9342/comments"},"review_comment":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9342/commits"},"statuses":{"href":"https://api.github.com/repos/sympy/sympy/statuses/717a236a49944b674f4ce7270d1bbfca254067a0"}}}}