js-big-decimal icon indicating copy to clipboard operation
js-big-decimal copied to clipboard

Wrong result when adding any number to -0

Open Yayo-Arellano opened this issue 2 years ago • 0 comments

Describe the bug Wrong result when adding any number to -0

To Reproduce

 const n1 = new bigDecimal('-0');
 const n2 = new bigDecimal('10');
 const diff1 = n1.add(n2);
print(diff1.getValue()); // Will print -890

Expected behavior The result should be 10

Additional context If the operation is adding -0 to 10 the result will be correct.

Yayo-Arellano avatar Jun 10 '22 13:06 Yayo-Arellano