{"action":"created","comment":{"url":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments/86281650","pull_request_review_id":6946656,"id":86281650,"diff_hunk":"@@ -32,16 +32,27 @@ Negative.isNegative = function(node) {\n   return false;\n }\n \n-Negative.negate = function(node) {\n-  if (NodeType.isUnaryMinus(node)) {\n-    return node.args[0];\n+// Given a node, returns the negated node\n+// If naive is true, then we just add an extra unary minus to the expression\n+// otherwise, we do the actual negation\n+// E.g.\n+//    not naive: -3 -> 3, x -> -x\n+//    naive: -3 -> --3, x -> -x\n+Negative.negate = function(node, naive=false) {\n+  if (NodeType.isConstantFraction(node)) {\n+    node.args[0] = Negative.negate(node.args[0], naive);\n+    return node;\n   }\n   else if (PolynomialTermNode.isPolynomialTerm(node)) {\n-    return PolynomialTermOperations.negatePolynomialTerm(node);\n+    return PolynomialTermOperations.negatePolynomialTerm(node, naive);\n   }\n-  else if (NodeType.isConstantFraction(node)) {\n-    node.args[0] = Negative.negate(node.args[0]);\n-    return node;\n+  else if (!naive) {\n+    if (NodeType.isUnaryMinus(node)) {\n+      return node.args[0];\n+    }\n+    else if (NodeType.isConstant(node)) {\n+      return NodeCreator.constant(0 - parseFloat(node.value));\n+    }\n   }\n \n   return NodeCreator.unaryMinus(node);","path":"lib/expression/step-solver/Negative.js","position":34,"original_position":34,"commit_id":"b786d9e8c8ecea4fb9f1a42ce790335c7e2744f7","original_commit_id":"b786d9e8c8ecea4fb9f1a42ce790335c7e2744f7","user":{"login":"evykassirer","id":5634097,"avatar_url":"https://avatars.githubusercontent.com/u/5634097?v=3","gravatar_id":"","url":"https://api.github.com/users/evykassirer","html_url":"https://github.com/evykassirer","followers_url":"https://api.github.com/users/evykassirer/followers","following_url":"https://api.github.com/users/evykassirer/following{/other_user}","gists_url":"https://api.github.com/users/evykassirer/gists{/gist_id}","starred_url":"https://api.github.com/users/evykassirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evykassirer/subscriptions","organizations_url":"https://api.github.com/users/evykassirer/orgs","repos_url":"https://api.github.com/users/evykassirer/repos","events_url":"https://api.github.com/users/evykassirer/events{/privacy}","received_events_url":"https://api.github.com/users/evykassirer/received_events","type":"User","site_admin":false},"body":"can you add a comment here saying that Negative.negate should be used for almost all cases instead of using the unraryMinus function?","created_at":"2016-11-03T03:14:55Z","updated_at":"2016-11-03T03:14:55Z","html_url":"https://github.com/socraticorg/mathjs/pull/42#discussion_r86281650","pull_request_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments/86281650"},"html":{"href":"https://github.com/socraticorg/mathjs/pull/42#discussion_r86281650"},"pull_request":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/socraticorg/mathjs/pulls/42","id":92031959,"html_url":"https://github.com/socraticorg/mathjs/pull/42","diff_url":"https://github.com/socraticorg/mathjs/pull/42.diff","patch_url":"https://github.com/socraticorg/mathjs/pull/42.patch","issue_url":"https://api.github.com/repos/socraticorg/mathjs/issues/42","number":42,"state":"open","locked":false,"title":"Showing two steps that we accidentally stopped showing","user":{"login":"aelnaiem","id":786569,"avatar_url":"https://avatars.githubusercontent.com/u/786569?v=3","gravatar_id":"","url":"https://api.github.com/users/aelnaiem","html_url":"https://github.com/aelnaiem","followers_url":"https://api.github.com/users/aelnaiem/followers","following_url":"https://api.github.com/users/aelnaiem/following{/other_user}","gists_url":"https://api.github.com/users/aelnaiem/gists{/gist_id}","starred_url":"https://api.github.com/users/aelnaiem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aelnaiem/subscriptions","organizations_url":"https://api.github.com/users/aelnaiem/orgs","repos_url":"https://api.github.com/users/aelnaiem/repos","events_url":"https://api.github.com/users/aelnaiem/events{/privacy}","received_events_url":"https://api.github.com/users/aelnaiem/received_events","type":"User","site_admin":false},"body":"[asana task](https://app.asana.com/0/201972293666219/list)","created_at":"2016-11-02T18:45:59Z","updated_at":"2016-11-03T03:14:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ecbe2908254a6d95f091ae830389d60cb2f7c76b","assignee":{"login":"evykassirer","id":5634097,"avatar_url":"https://avatars.githubusercontent.com/u/5634097?v=3","gravatar_id":"","url":"https://api.github.com/users/evykassirer","html_url":"https://github.com/evykassirer","followers_url":"https://api.github.com/users/evykassirer/followers","following_url":"https://api.github.com/users/evykassirer/following{/other_user}","gists_url":"https://api.github.com/users/evykassirer/gists{/gist_id}","starred_url":"https://api.github.com/users/evykassirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evykassirer/subscriptions","organizations_url":"https://api.github.com/users/evykassirer/orgs","repos_url":"https://api.github.com/users/evykassirer/repos","events_url":"https://api.github.com/users/evykassirer/events{/privacy}","received_events_url":"https://api.github.com/users/evykassirer/received_events","type":"User","site_admin":false},"assignees":[{"login":"evykassirer","id":5634097,"avatar_url":"https://avatars.githubusercontent.com/u/5634097?v=3","gravatar_id":"","url":"https://api.github.com/users/evykassirer","html_url":"https://github.com/evykassirer","followers_url":"https://api.github.com/users/evykassirer/followers","following_url":"https://api.github.com/users/evykassirer/following{/other_user}","gists_url":"https://api.github.com/users/evykassirer/gists{/gist_id}","starred_url":"https://api.github.com/users/evykassirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evykassirer/subscriptions","organizations_url":"https://api.github.com/users/evykassirer/orgs","repos_url":"https://api.github.com/users/evykassirer/repos","events_url":"https://api.github.com/users/evykassirer/events{/privacy}","received_events_url":"https://api.github.com/users/evykassirer/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/42/commits","review_comments_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/42/comments","review_comment_url":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/issues/42/comments","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/b786d9e8c8ecea4fb9f1a42ce790335c7e2744f7","head":{"label":"socraticorg:ae_plus_minus","ref":"ae_plus_minus","sha":"b786d9e8c8ecea4fb9f1a42ce790335c7e2744f7","user":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"repo":{"id":66677351,"name":"mathjs","full_name":"socraticorg/mathjs","owner":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socraticorg/mathjs","description":"An extensive math library for JavaScript and Node.js","fork":true,"url":"https://api.github.com/repos/socraticorg/mathjs","forks_url":"https://api.github.com/repos/socraticorg/mathjs/forks","keys_url":"https://api.github.com/repos/socraticorg/mathjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socraticorg/mathjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socraticorg/mathjs/teams","hooks_url":"https://api.github.com/repos/socraticorg/mathjs/hooks","issue_events_url":"https://api.github.com/repos/socraticorg/mathjs/issues/events{/number}","events_url":"https://api.github.com/repos/socraticorg/mathjs/events","assignees_url":"https://api.github.com/repos/socraticorg/mathjs/assignees{/user}","branches_url":"https://api.github.com/repos/socraticorg/mathjs/branches{/branch}","tags_url":"https://api.github.com/repos/socraticorg/mathjs/tags","blobs_url":"https://api.github.com/repos/socraticorg/mathjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socraticorg/mathjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socraticorg/mathjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/socraticorg/mathjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/{sha}","languages_url":"https://api.github.com/repos/socraticorg/mathjs/languages","stargazers_url":"https://api.github.com/repos/socraticorg/mathjs/stargazers","contributors_url":"https://api.github.com/repos/socraticorg/mathjs/contributors","subscribers_url":"https://api.github.com/repos/socraticorg/mathjs/subscribers","subscription_url":"https://api.github.com/repos/socraticorg/mathjs/subscription","commits_url":"https://api.github.com/repos/socraticorg/mathjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/socraticorg/mathjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/socraticorg/mathjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/socraticorg/mathjs/contents/{+path}","compare_url":"https://api.github.com/repos/socraticorg/mathjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socraticorg/mathjs/merges","archive_url":"https://api.github.com/repos/socraticorg/mathjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socraticorg/mathjs/downloads","issues_url":"https://api.github.com/repos/socraticorg/mathjs/issues{/number}","pulls_url":"https://api.github.com/repos/socraticorg/mathjs/pulls{/number}","milestones_url":"https://api.github.com/repos/socraticorg/mathjs/milestones{/number}","notifications_url":"https://api.github.com/repos/socraticorg/mathjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socraticorg/mathjs/labels{/name}","releases_url":"https://api.github.com/repos/socraticorg/mathjs/releases{/id}","deployments_url":"https://api.github.com/repos/socraticorg/mathjs/deployments","created_at":"2016-08-26T20:28:50Z","updated_at":"2016-08-26T20:28:52Z","pushed_at":"2016-11-02T21:40:49Z","git_url":"git://github.com/socraticorg/mathjs.git","ssh_url":"git@github.com:socraticorg/mathjs.git","clone_url":"https://github.com/socraticorg/mathjs.git","svn_url":"https://github.com/socraticorg/mathjs","homepage":"mathjs.org","size":32538,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"socraticorg:ek-mathsteps","ref":"ek-mathsteps","sha":"809b934beb59b3912ceb937210449443c728c816","user":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"repo":{"id":66677351,"name":"mathjs","full_name":"socraticorg/mathjs","owner":{"login":"socraticorg","id":4368132,"avatar_url":"https://avatars.githubusercontent.com/u/4368132?v=3","gravatar_id":"","url":"https://api.github.com/users/socraticorg","html_url":"https://github.com/socraticorg","followers_url":"https://api.github.com/users/socraticorg/followers","following_url":"https://api.github.com/users/socraticorg/following{/other_user}","gists_url":"https://api.github.com/users/socraticorg/gists{/gist_id}","starred_url":"https://api.github.com/users/socraticorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socraticorg/subscriptions","organizations_url":"https://api.github.com/users/socraticorg/orgs","repos_url":"https://api.github.com/users/socraticorg/repos","events_url":"https://api.github.com/users/socraticorg/events{/privacy}","received_events_url":"https://api.github.com/users/socraticorg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socraticorg/mathjs","description":"An extensive math library for JavaScript and Node.js","fork":true,"url":"https://api.github.com/repos/socraticorg/mathjs","forks_url":"https://api.github.com/repos/socraticorg/mathjs/forks","keys_url":"https://api.github.com/repos/socraticorg/mathjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socraticorg/mathjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socraticorg/mathjs/teams","hooks_url":"https://api.github.com/repos/socraticorg/mathjs/hooks","issue_events_url":"https://api.github.com/repos/socraticorg/mathjs/issues/events{/number}","events_url":"https://api.github.com/repos/socraticorg/mathjs/events","assignees_url":"https://api.github.com/repos/socraticorg/mathjs/assignees{/user}","branches_url":"https://api.github.com/repos/socraticorg/mathjs/branches{/branch}","tags_url":"https://api.github.com/repos/socraticorg/mathjs/tags","blobs_url":"https://api.github.com/repos/socraticorg/mathjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socraticorg/mathjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socraticorg/mathjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/socraticorg/mathjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socraticorg/mathjs/statuses/{sha}","languages_url":"https://api.github.com/repos/socraticorg/mathjs/languages","stargazers_url":"https://api.github.com/repos/socraticorg/mathjs/stargazers","contributors_url":"https://api.github.com/repos/socraticorg/mathjs/contributors","subscribers_url":"https://api.github.com/repos/socraticorg/mathjs/subscribers","subscription_url":"https://api.github.com/repos/socraticorg/mathjs/subscription","commits_url":"https://api.github.com/repos/socraticorg/mathjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/socraticorg/mathjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/socraticorg/mathjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/socraticorg/mathjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/socraticorg/mathjs/contents/{+path}","compare_url":"https://api.github.com/repos/socraticorg/mathjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socraticorg/mathjs/merges","archive_url":"https://api.github.com/repos/socraticorg/mathjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socraticorg/mathjs/downloads","issues_url":"https://api.github.com/repos/socraticorg/mathjs/issues{/number}","pulls_url":"https://api.github.com/repos/socraticorg/mathjs/pulls{/number}","milestones_url":"https://api.github.com/repos/socraticorg/mathjs/milestones{/number}","notifications_url":"https://api.github.com/repos/socraticorg/mathjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socraticorg/mathjs/labels{/name}","releases_url":"https://api.github.com/repos/socraticorg/mathjs/releases{/id}","deployments_url":"https://api.github.com/repos/socraticorg/mathjs/deployments","created_at":"2016-08-26T20:28:50Z","updated_at":"2016-08-26T20:28:52Z","pushed_at":"2016-11-02T21:40:49Z","git_url":"git://github.com/socraticorg/mathjs.git","ssh_url":"git@github.com:socraticorg/mathjs.git","clone_url":"https://github.com/socraticorg/mathjs.git","svn_url":"https://github.com/socraticorg/mathjs","homepage":"mathjs.org","size":32538,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/42"},"html":{"href":"https://github.com/socraticorg/mathjs/pull/42"},"issue":{"href":"https://api.github.com/repos/socraticorg/mathjs/issues/42"},"comments":{"href":"https://api.github.com/repos/socraticorg/mathjs/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/socraticorg/mathjs/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/socraticorg/mathjs/statuses/b786d9e8c8ecea4fb9f1a42ce790335c7e2744f7"}}}}
{"actor":{"display_login":"evykassirer"}}