-
Notifications
You must be signed in to change notification settings - Fork 1
Better negative fractions #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
5d01cc9
3aa6b47
626d787
110675a
92728b3
6a1924c
f21dc6c
b774b61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,9 @@ function flattenOperands(node) { | |
| return node; | ||
| } | ||
| else if (Node.Type.isUnaryMinus(node)) { | ||
| const arg = flattenOperands(node.args[0]); | ||
| // since arg is changed when it is negated, clone it before negation to avoid | ||
| // modifiying original reference | ||
| const arg = flattenOperands(node.args[0].cloneDeep()); | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we find the real pain. Note how the arg gets negated in the next line. When this is not cloned, it ends up messing up with the original node in stepThrough. if you boot up your node console and try solving For background, this was occuring in see L47: gasp! |
||
| const flattenedNode = Negative.negate(arg, true); | ||
| if (node.changeGroup) { | ||
| flattenedNode.changeGroup = node.changeGroup; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't allowing unary minus as a coefficient