Browse Source

CertainTrust.js updated for DISCOUNTING in SDK

Debashis Chandra Ray 6 years ago
parent
commit
d650beeebf
1 changed files with 4 additions and 4 deletions
  1. 4 4
      JavaScript/JavaScript_SDK/CertainTrust.js

+ 4 - 4
JavaScript/JavaScript_SDK/CertainTrust.js

@@ -604,7 +604,7 @@ CertainTrust.prototype._calculateRStoTC = function() {
 	var nrs = this.n * rs;
 	this.c = nrs / ((2 * this.weight * (this.n - this.r - this.s)) + nrs);
 	if (this._almostEqual(this.c, 0))
-		this.t = 0.5;
+		this.t = 0;
 	else
 		this.t = this.r / rs;
 };
@@ -617,7 +617,7 @@ CertainTrust.prototype._calculateTCtoRS = function() {
 	if (this._almostEqual(this.c, 0)) {
 		this.r = 0;
 		this.s = 0;
-		this.t = 0.5;
+		this.t = 0;
 	}
 	else {
 		var c2w = this.c * 2 * this.weight;
@@ -1008,12 +1008,12 @@ CertainTrust.prototype._singleDISCOUNTING = function(arg){
 	var f2 = arg.getF();
 	var t2 = arg.getT();
 
-	var resC = 0, resT = 0.5, resF = 0.5;
+	var resC = 0, resT = 0, resF = 0;
 
 	if (!this._operationAllowed(this, arg))
 		return undefined;
 
-	//resF = f1*f2;
+	resF = f2;
 	if (this._almostEqual(resF, 1))		//avoid division by 0
 		resC = t1*c1*c2;
 	else