Author Topic: Moneysupply Calculator  (Read 1940 times)

e1ghtSpace

  • Currently learning Python...
  • Admin
  • *****
  • Posts: 107
  • Part of the 1 year club
    • View Profile
Moneysupply Calculator
« on: January 30, 2015, 08:56:54 pm »
Hey everyone, I make a moneysupply calculator type thing with an app called Codea (ios).



This is what the moneysupply is today.

I should make it so that it takes the date and time and gives you a live reading.
(right now it just goes up 1 day/second)

e1ghtSpace

  • Currently learning Python...
  • Admin
  • *****
  • Posts: 107
  • Part of the 1 year club
    • View Profile
Re: Moneysupply Calculator
« Reply #1 on: January 30, 2015, 09:17:28 pm »
I figured out how I can remove the extra decimals from the blockreward.

roundedblockreward=blockreward*100000000

math.ceil(roundedblockreward + 0.5)

roundedblockreward=roundedblockreward/100000000

Then I used roundedblockreward instead of blockreward. (otherwise it decreases the blockreward faster.

e1ghtSpace

  • Currently learning Python...
  • Admin
  • *****
  • Posts: 107
  • Part of the 1 year club
    • View Profile
Re: Moneysupply Calculator
« Reply #2 on: January 31, 2015, 05:26:53 am »
Ok, fixed reward halvings to be every 2 000 000 blocks instead of 2 102 400.

I am also trying to understand this line in main.cpp;

nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

What does -= mean?  Does it mean nSubsidy=nSubsidy-*(blah blah blah?

Also, what does the % do?

Is this the same as:

nSubsidy=nSubsidy-((g_RewardHalvingPeriod/2)/g_RewardHalvingPeriod)

I am trying to reduce nSubsidy for each block in my calculator.


What does this whole thing mean;

Code: [Select]
int halvings = nHeight / g_RewardHalvingPeriod;
nSubsidy = (halvings >= 64)? 0 : (nSubsidy >> halvings);
nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

elbandi

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Moneysupply Calculator
« Reply #3 on: January 31, 2015, 03:57:05 pm »
Code: [Select]
nSubsidy = nSubsidy - (nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod));

e1ghtSpace

  • Currently learning Python...
  • Admin
  • *****
  • Posts: 107
  • Part of the 1 year club
    • View Profile
Re: Moneysupply Calculator
« Reply #4 on: January 31, 2015, 04:41:08 pm »
Code: [Select]
nSubsidy = nSubsidy - (nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod));
Thanks, but what is the %?

Mr. Spread

  • Core Developer
  • Posts: 105
    • View Profile
Re: Moneysupply Calculator
« Reply #5 on: January 31, 2015, 06:11:10 pm »
Ok, fixed reward halvings to be every 2 000 000 blocks instead of 2 102 400.

I am also trying to understand this line in main.cpp;

nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

What does -= mean?  Does it mean nSubsidy=nSubsidy-*(blah blah blah?

Also, what does the % do?

Is this the same as:

nSubsidy=nSubsidy-((g_RewardHalvingPeriod/2)/g_RewardHalvingPeriod)

I am trying to reduce nSubsidy for each block in my calculator.


What does this whole thing mean;

Code: [Select]
int halvings = nHeight / g_RewardHalvingPeriod;
nSubsidy = (halvings >= 64)? 0 : (nSubsidy >> halvings);
nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);
a -= b means a = a - b.
% is the modulo operation.
>> is a right bit shift, it multiples number to the left to the negative power of two of the number to the right.

e1ghtSpace

  • Currently learning Python...
  • Admin
  • *****
  • Posts: 107
  • Part of the 1 year club
    • View Profile
Re: Moneysupply Calculator
« Reply #6 on: March 27, 2015, 11:11:40 am »
Ok, fixed reward halvings to be every 2 000 000 blocks instead of 2 102 400.

I am also trying to understand this line in main.cpp;

nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

What does -= mean?  Does it mean nSubsidy=nSubsidy-*(blah blah blah?

Also, what does the % do?

Is this the same as:

nSubsidy=nSubsidy-((g_RewardHalvingPeriod/2)/g_RewardHalvingPeriod)

I am trying to reduce nSubsidy for each block in my calculator.


What does this whole thing mean;

Code: [Select]
int halvings = nHeight / g_RewardHalvingPeriod;
nSubsidy = (halvings >= 64)? 0 : (nSubsidy >> halvings);
nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);
a -= b means a = a - b.
% is the modulo operation.
>> is a right bit shift, it multiples number to the left to the negative power of two of the number to the right.
Ah ok, The modulo operation is the remainder when dividing the left number by the right number, right?
I'll fix my calculator with that modulo operation.
I also need to reprogram the graph rendering. It'll be done in the next few days. But its not like anyone cares anyway. :/

pokeytex

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Moneysupply Calculator
« Reply #7 on: March 28, 2015, 03:17:59 am »
Ok, fixed reward halvings to be every 2 000 000 blocks instead of 2 102 400.

I am also trying to understand this line in main.cpp;

nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

What does -= mean?  Does it mean nSubsidy=nSubsidy-*(blah blah blah?

Also, what does the % do?

Is this the same as:

nSubsidy=nSubsidy-((g_RewardHalvingPeriod/2)/g_RewardHalvingPeriod)

I am trying to reduce nSubsidy for each block in my calculator.


What does this whole thing mean;

Code: [Select]
int halvings = nHeight / g_RewardHalvingPeriod;
nSubsidy = (halvings >= 64)? 0 : (nSubsidy >> halvings);
nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);
a -= b means a = a - b.
% is the modulo operation.
>> is a right bit shift, it multiples number to the left to the negative power of two of the number to the right.
Ah ok, The modulo operation is the remainder when dividing the left number by the right number, right?
I'll fix my calculator with that modulo operation.
I also need to reprogram the graph rendering. It'll be done in the next few days. But its not like anyone cares anyway. :/

It's not over until it's over.  I care.

njs811

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Moneysupply Calculator
« Reply #8 on: March 28, 2015, 05:58:57 am »
Ok, fixed reward halvings to be every 2 000 000 blocks instead of 2 102 400.

I am also trying to understand this line in main.cpp;

nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

What does -= mean?  Does it mean nSubsidy=nSubsidy-*(blah blah blah?

Also, what does the % do?

Is this the same as:

nSubsidy=nSubsidy-((g_RewardHalvingPeriod/2)/g_RewardHalvingPeriod)

I am trying to reduce nSubsidy for each block in my calculator.


What does this whole thing mean;

Code: [Select]
int halvings = nHeight / g_RewardHalvingPeriod;
nSubsidy = (halvings >= 64)? 0 : (nSubsidy >> halvings);
nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);
a -= b means a = a - b.
% is the modulo operation.
>> is a right bit shift, it multiples number to the left to the negative power of two of the number to the right.
Ah ok, The modulo operation is the remainder when dividing the left number by the right number, right?
I'll fix my calculator with that modulo operation.
I also need to reprogram the graph rendering. It'll be done in the next few days. But its not like anyone cares anyway. :/

You are doing good work. Thank-you.

e1ghtSpace

  • Currently learning Python...
  • Admin
  • *****
  • Posts: 107
  • Part of the 1 year club
    • View Profile
Re: Moneysupply Calculator
« Reply #9 on: March 28, 2015, 06:00:18 am »
Ok, fixed reward halvings to be every 2 000 000 blocks instead of 2 102 400.

I am also trying to understand this line in main.cpp;

nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);

What does -= mean?  Does it mean nSubsidy=nSubsidy-*(blah blah blah?

Also, what does the % do?

Is this the same as:

nSubsidy=nSubsidy-((g_RewardHalvingPeriod/2)/g_RewardHalvingPeriod)

I am trying to reduce nSubsidy for each block in my calculator.


What does this whole thing mean;

Code: [Select]
int halvings = nHeight / g_RewardHalvingPeriod;
nSubsidy = (halvings >= 64)? 0 : (nSubsidy >> halvings);
nSubsidy -= nSubsidy*(nHeight % g_RewardHalvingPeriod)/(2*g_RewardHalvingPeriod);
a -= b means a = a - b.
% is the modulo operation.
>> is a right bit shift, it multiples number to the left to the negative power of two of the number to the right.
Ah ok, The modulo operation is the remainder when dividing the left number by the right number, right?
I'll fix my calculator with that modulo operation.
I also need to reprogram the graph rendering. It'll be done in the next few days. But its not like anyone cares anyway. :/

You are doing good work. Thank-you.
Wow, weirdest thing just happened. I was JUST reading this topic and you replied.
Thanks for the encouragement. You too pokeytex.