Find an Online Tutor Now

Daniel P.

asked • 06/22/17

Alright my question is a little long... here we go:

I'm using two formulas in a game that I'm making. One let's you know how many "Stocks" you'll earn depending on how much you've earned in the lifetime of the game. The other let's you know how much you need to earn in a session to gain x number of Stocks.

Stocks = 160 * sqrt (Lifetime Earnings / 10^15)


Session Earnings = 10^15 * (Stocks / 160)^2

You can plug the desired amount of stocks into Formula 2 and it will let you know how much you have to earn. You can also enter your current lifetime earnings and it will let you know how many stocks you can claim with Formula 1.

Now the problem I'm having is that eventually we'll have numbers as big as 10^335, and we cannot efficiently store values that big.
In order to save some memory, we decided to go with this instead.

10^3 = 1
10^6 = 2
10^9 = 3
10^12 = 4.... and so on.
Also, it's worth noting that once the values get really big, we are only storing up to 9 decimal places to maintain efficiency.
For Example: $58,987,952,658,423,568,721,358,444     would be displayed as:  $58.987952658 : 8
and as we know, 8 = 10^24

Can we modify both formulas so that we can simply enter values in this ($58.987952658 : 8) format to determine how many stocks will be earned?

Thank you in advance! 

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.