corr double mult

This commit is contained in:
dimxy
2019-04-30 00:52:47 +05:00
parent 656992811c
commit b800a223c5

View File

@@ -1334,11 +1334,11 @@ UniValue PricesInfo(uint256 bettxid, int32_t refheight)
int64_t totalbets = 0; int64_t totalbets = 0;
int64_t totalprofits = 0; int64_t totalprofits = 0;
long double dcostbasis = 0.0; double dcostbasis = 0.0;
for (auto b : bets) { for (auto b : bets) {
totalbets += b.amount; totalbets += b.amount;
totalprofits += b.profits; totalprofits += b.profits;
dcostbasis += b.amount * b.costbasis; dcostbasis += b.amount * (double)b.costbasis;
// costbasis += b.amount * (b.costbasis / PRICES_POINTFACTOR); // prevent int64 overflow (but we have underflow for 1/BTC) // costbasis += b.amount * (b.costbasis / PRICES_POINTFACTOR); // prevent int64 overflow (but we have underflow for 1/BTC)
std::cerr << "PricesInfo() acc dcostbasis=" << dcostbasis << " b.amount=" << b.amount << " b.costbasis/PRICES_POINTFACTOR=" << (b.costbasis / PRICES_POINTFACTOR) << std::endl; std::cerr << "PricesInfo() acc dcostbasis=" << dcostbasis << " b.amount=" << b.amount << " b.costbasis/PRICES_POINTFACTOR=" << (b.costbasis / PRICES_POINTFACTOR) << std::endl;
} }