Minor correction, since nSubsidy starts out as an int64, the math should be pow(0.95,4)*2500000000 == 2036265624.9999998, which is being cast back to an int64 type at
https://github.com/DNotesCoin/DNotes/blob/master/src/main.cpp#L853Expected behavior when casting a floating point value to an int is that the number is truncated (not rounded). See
https://stackoverflow.com/questions/9695329/c-how-to-round-a-double-to-an-intPatching main.cpp in the following manner (assuming rounding is the desired behavior) appears to fix the issue:
diff --git a/src/main.cpp b/src/main.cpp
index 4773964..48d7b3c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -850,7 +850,7 @@ int64 static GetBlockValue(int nHeight, int64 nFees)
{
int yearsElapsed = nHeight / 525949;
double nReductionPercentage = pow(0.95,yearsElapsed);
- nSubsidy = nSubsidy * nReductionPercentage;
+ nSubsidy = (int64) ((nSubsidy * nReductionPercentage)+0.5);
}
return nSubsidy + nFees;
}