-
Notifications
You must be signed in to change notification settings - Fork 57
Fix sign error in BigInt::leftShift. #63
Changes from all commits
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 |
---|---|---|
|
@@ -313,9 +313,7 @@ <h1>BigInt::subtract (_x_, _y_)</h1> | |
<h1>BigInt::leftShift (_x_, _y_)</h1> | ||
<p>The abstract operation BigInt::leftShift with two arguments _x_ and _y_ of BigInt:</p> | ||
<emu-alg> | ||
1. If _y_ < 0, | ||
1. Return a BigInt representing _x_ divided by 2<sup>_y_</sup>, rounding down to the nearest integer, including for negative numbers. | ||
1. Return a BigInt representing _x_ multiplied by 2<sup>_y_</sup>. | ||
1. Return a BigInt representing _x_ multiplied by 2<sup>_y_</sup>, rounding down to the nearest integer, including for negative numbers. | ||
</emu-alg> | ||
<emu-note>Semantics here should be equivalent to a bitwise shift, treating the BigInt as an infinite length string of binary two's complement digits.</emu-note> | ||
</emu-clause> | ||
|
@@ -324,7 +322,7 @@ <h1>BigInt::leftShift (_x_, _y_)</h1> | |
<h1>BigInt::signedRightShift (_x_, _y_)</h1> | ||
<p>The abstract operation BigInt::signedRightShift with arguments _x_ and _y_ of type BigInt:</p> | ||
<emu-alg> | ||
1. Return ? BigInt::leftShift(_x_, -_y_). | ||
1. Return BigInt::leftShift(_x_, -_y_). | ||
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. Nit: Rather than eliminating the 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. Fine with me, but then the same should be done in the other definitions in 1.1 (that's 5 or 6 changes). 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. Never mind, really there's no way that this could possibly throw. I'll take your change here. |
||
</emu-alg> | ||
</emu-clause> | ||
|
||
|
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.
I'd actually like to keep the original, more wordy phrasing, since I believe we'll work towards a specification with no mathematical values and instead all numeric values in spec-land being either Numbers or BigInts (see #10). The small fraction in your spec text is not always representable as either. We could fix the issue more minimally by just inserting a
-
here, right?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.
Okay, I need to read this when I have more time, but to answer your question: yes.