From 544105e23d319f77f2ede91746f7978c1ae3d3d8 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Fri, 22 Feb 2013 13:47:26 +0100 Subject: [PATCH] JS: Prevent Amount#negate from creating amounts that are negative zero. --- src/js/amount.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/amount.js b/src/js/amount.js index 03c7748694..9d494851c7 100644 --- a/src/js/amount.js +++ b/src/js/amount.js @@ -276,6 +276,9 @@ Amount.prototype.copyTo = function (d, negate) { this._currency.copyTo(d._currency); this._issuer.copyTo(d._issuer); + // Prevent negative zero + if (d.is_zero()) d._is_negative = false; + return d; };