Skip to content
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

Multiplying an unsigned zero produces a signed zero #72

Closed
Zalathar opened this issue Oct 11, 2018 · 2 comments
Closed

Multiplying an unsigned zero produces a signed zero #72

Zalathar opened this issue Oct 11, 2018 · 2 comments

Comments

@Zalathar
Copy link

Steps to reproduce:

const Long = require('long');
const x = Long.UZERO.mul(10);

Expected behaviour:

x.unsigned === true

Actual behaviour:

x.unsigned === false
@Zalathar
Copy link
Author

This seems to be caused by the check for zero that unconditionally returns ZERO, without consulting self.unsigned:

long.js/src/long.js

Lines 864 to 866 in 9448e61

LongPrototype.multiply = function multiply(multiplier) {
if (this.isZero())
return ZERO;

@dcodeIO
Copy link
Owner

dcodeIO commented Oct 11, 2018

Yeah, should return this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants