We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
mod
+---------------+----------------+-----------------+---------------+ | first operand | second operand | expected output | actual output | +---------------+----------------+-----------------+---------------+ | -1 | -2 | -1 | -1 | +---------------+----------------+-----------------+---------------+ | -1 | +2 | +1 | -1 | +---------------+----------------+-----------------+---------------+ | +1 | -2 | -1 | +1 | +---------------+----------------+-----------------+---------------+ | +1 | +2 | +1 | +1 | +---------------+----------------+-----------------+---------------+
When one operand is positive and the other operand is negative, the actual output is the negation of the expected output.
Expected output calculated via Python:
def format(x): return ('+' if x > 0 else '') + str(x) def mod(x, y): print('(' + format(x) + ') % (' + format(y) + ') = ' + format(x % y)) mod(-1, -2) mod(-1, +2) mod(+1, -2) mod(+1, +2)
Actul output calculated via JavaScript:
function format(x) { return (x.gtn(0) ? '+' : '') + x.toString(); } function mod(x, y) { console.log('(' + format(x) + ') % (' + format(y) + ') = ' + format(x.mod(y))); } mod(new BN(-1), new BN(-2)); mod(new BN(-1), new BN(+2)); mod(new BN(+1), new BN(-2)); mod(new BN(+1), new BN(+2));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When one operand is positive and the other operand is negative, the actual output is the negation of the expected output.
Expected output calculated via Python:
Actul output calculated via JavaScript:
The text was updated successfully, but these errors were encountered: