From e184500052a1b2fd6cf596ffd557e8c529af075b Mon Sep 17 00:00:00 2001 From: Viktor Date: Sun, 29 Jan 2017 11:40:33 +0500 Subject: [PATCH 1/2] some fixes for the pow and comparision methods greaterEqualThan, greaterEqualThanDouble, lessEqualThan, lessEqualThanDouble, pow --- src/longdouble.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/longdouble.coffee b/src/longdouble.coffee index 45662d7..4366c49 100644 --- a/src/longdouble.coffee +++ b/src/longdouble.coffee @@ -387,12 +387,12 @@ class CSLongDouble # Imp 24: Trivial # greaterEqualThan: (other) -> - return @hi >= other.hi || (@hi == other.hi && @lo >= other.lo) + return @hi > other.hi || (@hi == other.hi && @lo >= other.lo) # Imp 25: Trivial # greaterEqualThanDouble: (other) -> - return @hi >= other || (@hi == other && @lo >= 0.0) + return @hi > other || (@hi == other && @lo >= 0.0) # Imp 26: Trivial # @@ -407,12 +407,12 @@ class CSLongDouble # Imp 28: Trivial # lessEqualThan: (other) -> - return @hi <= other.hi || (@hi == other.hi && @lo <= other.lo) + return @hi < other.hi || (@hi == other.hi && @lo <= other.lo) # Imp 29: Trivial # lessEqualThanDouble: (other) -> - return @hi <= other || (@hi == other && @lo <= 0.0) + return @hi < other || (@hi == other && @lo <= 0.0) # Imp 30: Trivial # @@ -442,7 +442,7 @@ class CSLongDouble if p % 2 == 1 s = s.mul(r) - p = p / 2.0 + p = Math.floor(p / 2.0) if p > 0.0 r = r.mul(r) From f33aba6be6852bf71bcc1f9be01ed67656c8b67d Mon Sep 17 00:00:00 2001 From: Viktor Date: Sun, 29 Jan 2017 11:41:56 +0500 Subject: [PATCH 2/2] some fixes for the pow and comparision methods --- lib/longdouble.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/longdouble.js b/lib/longdouble.js index ccf9b6c..b270a86 100644 --- a/lib/longdouble.js +++ b/lib/longdouble.js @@ -248,11 +248,11 @@ }; CSLongDouble.prototype.greaterEqualThan = function(other) { - return this.hi >= other.hi || (this.hi === other.hi && this.lo >= other.lo); + return this.hi > other.hi || (this.hi === other.hi && this.lo >= other.lo); }; CSLongDouble.prototype.greaterEqualThanDouble = function(other) { - return this.hi >= other || (this.hi === other && this.lo >= 0.0); + return this.hi > other || (this.hi === other && this.lo >= 0.0); }; CSLongDouble.prototype.lessThan = function(other) { @@ -264,11 +264,11 @@ }; CSLongDouble.prototype.lessEqualThan = function(other) { - return this.hi <= other.hi || (this.hi === other.hi && this.lo <= other.lo); + return this.hi < other.hi || (this.hi === other.hi && this.lo <= other.lo); }; CSLongDouble.prototype.lessEqualThanDouble = function(other) { - return this.hi <= other || (this.hi === other && this.lo <= 0.0); + return this.hi < other || (this.hi === other && this.lo <= 0.0); }; CSLongDouble.prototype.abs = function() { @@ -291,7 +291,7 @@ if (p > 1.0) { while (p > 0.0) { if (p % 2 === 1) s = s.mul(r); - p = p / 2.0; + p = Math.floor(p / 2.0); if (p > 0.0) r = r.mul(r); } } else {