Search content
Sort by

Showing 6 of 6 results by Redmb
Post
Topic
Board Games and rounds
Re: 1000 BTC GIVEAWAY! From your friend rekcahxfb
by
Redmb
on 03/08/2016, 19:12:31 UTC
1K7KhCvcuH91i7X3Wwj8xFPkX2wtEiqQVN
Post
Topic
Board Archival
Re: [ANN] [ILT] Intellect | X11 | 3650% Annually
by
Redmb
on 07/03/2015, 08:04:31 UTC
And got results:
Code:
nSubsidy1 = -10780497
nSubsidy2 = 1000000000


Guess the GC code had an integer overflow in it  Wink Like I explained, this is what happens when you use too much math and go over a 9 quintillion satoshi calculation. That's 9 with 18 zeroes. Although that's pretty hard to believe, apparently it's happening on multiple coins now too. Surprise!

*sets off fireworks*

Coins ops are the worst programmers.  Kiss

Satoshi didn't expect such calculations  Wink
Post
Topic
Board Archival
Re: [ANN] [ILT] Intellect | X11 | 3650% Annually
by
Redmb
on 07/03/2015, 05:19:07 UTC
That's not the issue. The value is to be returned in satoshis (multiplied by COIN). I thought I made that perfectly clear.
So, is nSubsidy1 and nSubsidy2 equal?

Can't tell if trolling or you can't figure it out =p

int64_t nRewardCoinYear;
nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE; // 36.5 * COIN (main.h)
int64_t nCoinAge = 100 * COIN * 1;
int64_t nSubsidy = nCoinAge * nRewardCoinYear / 365 / COIN;

nSubsidy = 100 * COIN * 1 * 36.5 * COIN / 365 / COIN;
nSubsidy = 100 * COIN * 1 * 36.5 / 365;

Is it correct? Value is multiplied by COIN? nSubsidy in satoshi format?

ps
So, is nSubsidy1 and nSubsidy2 equal?

Sorry, thought you were totally trolling before. Yes, the bottom two nSubsidy are equal.

Thanks.
I wrote a little code to check it:
Code:
#include

#ifndef WIN32
#include
#endif

int main(void) {
    int64_t COIN = 100000000;
    int64_t MAX_MINT_PROOF_OF_STAKE = 36.5 * COIN;
    int64_t nCoinAge = 100 * COIN * 1; // actually 100 coins one day aged
    int64_t nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;

    int64_t nSubsidy1 = nCoinAge * nRewardCoinYear / 365 / COIN;
    int64_t nSubsidy2 = nCoinAge / COIN * nRewardCoinYear / 365;

    printf("nSubsidy1= %ld\n", nSubsidy1);
    printf("nSubsidy2= %ld\n", nSubsidy2);
}

And got results:
Code:
nSubsidy1 = -10780497
nSubsidy2 = 1000000000

So, results are equal for human, but computer thinks different )

Quote from: tryphe
In the first statement(one above the bottom) the earlier *COIN will be "reversed" by the later /COIN. But there's no reason to have that many operations. nSubsidy is the satoshi value of the block, so since age is the only real factor here. Usually (for neatness and speed) you want to convert to satoshis last and not keep switching between 1s(coin) and 10,000,000s(satoshi). You want something neat and readable like this:

Code:
const int64_t MAX_PROOF_OF_STAKE_DAILY_DIVISOR = 10; // 10% daily
nSubsidy = nCoinAge / MAX_PROOF_OF_STAKE_DAILY_DIVISOR * COIN;

Dividing by 10 is an easy way to multiply by 0.1 (daily age modifier towards reward) and to avoid using floating points. Then you multiply by COIN to calculate the satoshi value. This is actually exactly the same math as the existing algorithmn, but simplified, and another *COIN added. Here is the original logic and why we are dividing by 10:

nRewardCoinYear / 365 / COIN  ==  36.5 * COIN / 365 / COIN  ==  0.1

There is NO need to do all of those operations other than if you're reading the code and have no idea what the 0.1 value means, or if you are trying to do math in years instead of days, like above. Now it looks pretty retarded, doesn't it?

Keep in mind that's untested so definitely don't use that until you test it, and it might be missing something(I'm sure it is) Smiley

Hope that makes a bit more sense.

Sure.
Post
Topic
Board Archival
Re: [ANN] [ILT] Intellect | X11 | 3650% Annually
by
Redmb
on 07/03/2015, 00:07:13 UTC
That's not the issue. The value is to be returned in satoshis (multiplied by COIN). I thought I made that perfectly clear.
So, is nSubsidy1 and nSubsidy2 equal?

Can't tell if trolling or you can't figure it out =p

int64_t nRewardCoinYear;
nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE; // 36.5 * COIN (main.h)
int64_t nCoinAge = 100 * COIN * 1;
int64_t nSubsidy = nCoinAge * nRewardCoinYear / 365 / COIN;

nSubsidy = 100 * COIN * 1 * 36.5 * COIN / 365 / COIN;
nSubsidy = 100 * COIN * 1 * 36.5 / 365;

Is it correct? Value is multiplied by COIN? nSubsidy in satoshi format?

ps
So, is nSubsidy1 and nSubsidy2 equal?
Post
Topic
Board Archival
Re: [ANN] [ILT] Intellect | X11 | 3650% Annually
by
Redmb
on 06/03/2015, 23:44:46 UTC
That's not the issue. The value is to be returned in satoshis (multiplied by COIN). I thought I made that perfectly clear.
So, is nSubsidy1 and nSubsidy2 equal?
Post
Topic
Board Archival
Re: [ANN] [ILT] Intellect | X11 | 3650% Annually
by
Redmb
on 06/03/2015, 23:35:19 UTC
Post revised because OP is a liar.

(ILT main.h L41)
Code:
static const int64_t MAX_MINT_PROOF_OF_STAKE = 36.50 * COIN; // 3650% annual interest
(ILT main.cpp L998)
Code:
int64_t nRewardCoinYear;
nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;
int64_t nSubsidy = nCoinAge * nRewardCoinYear / 365 / COIN;

I was going to post a solution, but since you are intent on lying to all of us, I don't think that's wise. Not a complete clone, but it's up the family tree. Anyone with half a brain(in fact math only needs half) could figure out how to simplify this to make overflows practically impossible. What they might not see, is that dividing by COIN still puts the fuckin return value in non-satoshi format (THE REQUIRED FORMAT). The same thing I posted 11 pages ago. There is a little more to it, though.

Did you calculate below

Code:
int64_t COIN = 100000000;
int64_t MAX_MINT_PROOF_OF_STAKE = 36.5 * COIN;
int64_t nCoinAge = 100 * COIN * 1; // actually 100 coins one day aged
int64_t nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;

int64_t nSubsidy1 = nCoinAge * nRewardCoinYear / 365 / COIN;

and

Code:
int64_t COIN = 100000000;
int64_t MAX_MINT_PROOF_OF_STAKE = 36.5 * COIN;
int64_t nCoinAge = 100 * COIN * 1; // actually 100 coins one day aged
int64_t nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;

int64_t nSubsidy2 = nCoinAge / COIN * nRewardCoinYear / 365;

Is nSubsidy1 equal to nSubsidy2?