Author Topic: Wonky block reward rounding?  (Read 98 times)

Offline coldacid

  • Jr. Member
  • **
  • Posts: 4
  • Karma: +0/-0
  • Cryptocoin enthusiast
    • View Profile
Wonky block reward rounding?
« on: July 19, 2013, 10:35:38 pm »
Something that's tickled me as odd is the rounding of the block reward to a hundredth of a coin. What's more odd is how the rounding is almost always down even when typical rounding rules would round up as closest to nearest cent, except for some strange occurrences where the reward is rounded up when it should have been down.

For example, block 1 had a difficulty of 7, meaning the unrounded reward would be 20.38775510. However, the actual reward given was simply 20.38. Compare to block 47797, where the unrounded reward would be 12.81390872 but the actual reward was 12.82.

So why the rounding, and why is the rounding code so capricious?
฿: 19vLnURhwLerU3GUBhrBg5BtH6prbtS6fP | Ł: LSF2HPr3ntQihTa9pfXLRCNy5rnaPxeGc5
Ᵽ: PVFHq13KpBPTRKgmmXgDwNZG371XJYfqN3 | Ψ: Ad4miH8RMRW9brKhew8xzyTBagczwd6fEb

Offline coldacid

  • Jr. Member
  • **
  • Posts: 4
  • Karma: +0/-0
  • Cryptocoin enthusiast
    • View Profile
Re: Wonky block reward rounding?
« Reply #1 on: July 19, 2013, 10:43:56 pm »
The rounding itself is on line 232 in prime.cpp in the TargetGetMint function. It looks simple and standard, so perhaps the wayward direction of rounding is a sign of a bug somewhere in the CBigNum class with regard to multiplication and division. Still, that doesn't explain why rewards are being rounded to the nearest cent, which is the real crux of the issue here.
฿: 19vLnURhwLerU3GUBhrBg5BtH6prbtS6fP | Ł: LSF2HPr3ntQihTa9pfXLRCNy5rnaPxeGc5
Ᵽ: PVFHq13KpBPTRKgmmXgDwNZG371XJYfqN3 | Ψ: Ad4miH8RMRW9brKhew8xzyTBagczwd6fEb

Offline Sunny King

  • PPC & XPM Architect
  • Full Member
  • *******
  • Posts: 78
  • Karma: +20/-1
    • View Profile
Re: Wonky block reward rounding?
« Reply #2 on: July 20, 2013, 01:39:21 am »
Mint amount is always floored to the cent. Block 47797 has a user transaction so there is 1 cent transaction fee collected.

1 cent is the minimum transaction amount in primecoin.

Offline coldacid

  • Jr. Member
  • **
  • Posts: 4
  • Karma: +0/-0
  • Cryptocoin enthusiast
    • View Profile
Re: Wonky block reward rounding?
« Reply #3 on: July 20, 2013, 01:58:22 pm »
Why is it always floored, though? That it always has been is no explanation.
฿: 19vLnURhwLerU3GUBhrBg5BtH6prbtS6fP | Ł: LSF2HPr3ntQihTa9pfXLRCNy5rnaPxeGc5
Ᵽ: PVFHq13KpBPTRKgmmXgDwNZG371XJYfqN3 | Ψ: Ad4miH8RMRW9brKhew8xzyTBagczwd6fEb