Skip to content

Commit

Permalink
another difficulty fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptowizzard committed Jan 27, 2016
1 parent 919d696 commit 64b7d43
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,34 +128,34 @@

//res.month = res.day * 30;
res.month = 0;
var dayinc = Math.pow(1.05,1/30);
var dayinc = Math.pow(1 + diff,1/30);
for (var i = 0; i < 30; i++)
res.month += res.day / Math.pow(dayinc, i);

res.year = 0;
for (var i = 0; i < 12; i++)
res.year += res.month / Math.pow(1.05, i);
res.year += res.month / Math.pow(1 + diff, i);

return res;
})(userCurrencyPerMin, network.hashrateIncrement);

// estimate the generated monthly given an expected difficulty increase
var predictedRev = (function(min, network){
var predictedRev = (function(min, diff){
var res = [];

var mo = 0;
var dd = min * 60 * 24;
var dayinc = Math.pow(1.05,1/30);
var dayinc = Math.pow(1 + diff, 1/30);
for (var i = 0; i < 30; i++)
mo += dd / Math.pow(dayinc, i);

for (var i = 0; i < 12; i++)
{
res[i] = mo / Math.pow(1.05, i);
res[i] = mo / Math.pow(1 + diff, i);
}

return res;
})(userCurrencyPerMin, network);
})(userCurrencyPerMin, network.hashrateIncrement);

var sumArray = function(arr){ var total = 0.0; for (var i = 0; i < arr.length; i++) total += arr[i]; return total;};

Expand Down

0 comments on commit 64b7d43

Please sign in to comment.