## Money negative while surplus

**Moderators:** Balthagor, Moderators

### Re: Money negative while surplus

This reply I posted before your testing post with the values.

So please understand this is NOT a reply to your latest post with the testing values in excel.

Baltagor, I'm sorry but both you and Dylan are wrong!

You don't pick a difference based on large numbers and then do the math like:

change versus total = 0.04% and thus neglectible.

Why that math is wrong is simple to understand, but basically you are using absolute treasure values to estimate the rounding error on increase/expenses and that's just simply wrong.

Any economics in the world can tell you what you are calculating is a value with no use at all, it says nothing.

If my treasure were let's say: 1,000,000,000,000,000,000,000,000,000 those 202,000,000 would be 0,0000000000000000202%

And if my treasure were let's say 1 those 202,000,000 would be 202,000,000%

So in 1 case you claim the rounding value is well, 0,00% and in the other case its 202 Million Percent!!! And this points out pretty much why it's wrong.

The correct way to estimate the rounding error is exactly the way I did it:

All expenses adding up

All income adding up

the difference is what should be added or subtracted from the treasure.

the rounding error of your math is then the actual difference between your calculations what is added or substracted in the game engine and what should be added or substracted with 0 rounding errors

and this difference divided by the value that should be added and that's a huge percentage.

You COULD, also make it relative to the total income for that turn by which the rounding error would come to 4%. and this 4% is there regardless of if I have 1 Trillion or just 1 Million.

Either way is too big.

But you NEVER EVER can figure the rounding error of 2 sums and their difference based on if I would take the integral of these differences based over a time frame of x with x larger then 1.

That's definitely wrong logic.

And let us not get into your claim that 4% and 0.04% would be a factor 10.. because I doubt you read what you just wrote by writing that. If you read your own post, I'm sure a smart man like

you will notice 4 and 0.04 is a factor 10^2 and not 10^1

So please understand this is NOT a reply to your latest post with the testing values in excel.

Baltagor, I'm sorry but both you and Dylan are wrong!

You don't pick a difference based on large numbers and then do the math like:

change versus total = 0.04% and thus neglectible.

Why that math is wrong is simple to understand, but basically you are using absolute treasure values to estimate the rounding error on increase/expenses and that's just simply wrong.

Any economics in the world can tell you what you are calculating is a value with no use at all, it says nothing.

If my treasure were let's say: 1,000,000,000,000,000,000,000,000,000 those 202,000,000 would be 0,0000000000000000202%

And if my treasure were let's say 1 those 202,000,000 would be 202,000,000%

So in 1 case you claim the rounding value is well, 0,00% and in the other case its 202 Million Percent!!! And this points out pretty much why it's wrong.

The correct way to estimate the rounding error is exactly the way I did it:

All expenses adding up

All income adding up

the difference is what should be added or subtracted from the treasure.

the rounding error of your math is then the actual difference between your calculations what is added or substracted in the game engine and what should be added or substracted with 0 rounding errors

and this difference divided by the value that should be added and that's a huge percentage.

You COULD, also make it relative to the total income for that turn by which the rounding error would come to 4%. and this 4% is there regardless of if I have 1 Trillion or just 1 Million.

Either way is too big.

But you NEVER EVER can figure the rounding error of 2 sums and their difference based on if I would take the integral of these differences based over a time frame of x with x larger then 1.

That's definitely wrong logic.

And let us not get into your claim that 4% and 0.04% would be a factor 10.. because I doubt you read what you just wrote by writing that. If you read your own post, I'm sure a smart man like

you will notice 4 and 0.04 is a factor 10^2 and not 10^1

Last edited by mrgenie on Jul 27 2018, edited 1 time in total.

### Re: Money negative while surplus

This post is the reply to the testing you did.. read it carefully! I hope you see the error in your logic.

You're math is correct but your logic is wrong. We can't argue about the math if you use the wrong logic ..

wrong logic = wrong input and wrong assumption.

So if you can't see the logic, look at the numbers...

every single day you can clearly see the income is BIGGER then the expense!!!

Every single day you can clearly see the TRADE is PLUS!

But every single day the treasury is going down!

And you fail to recognize your logic is wrong :(

You do the % on the wrong logic.

You are doing the error rate on the total treasury and claim that's 0,04% and thus small and thus not noticeble and that's wrong.

What you should do is calculate the wrong value on what should have been changed.. that's the error %

let's have a look at juli 8. The treasury is 451.544 and should become on juli 9: +1473-1459+31,04-0,06+11,42 = 451.600,04 )

but you actually got on July 9: 451.454,00

Thus missing is 146,40

The correct changed value would be 451.600,04 - 451.544 = 56.04 (plus)

but we have 146 (minus)

so the percentage of wrong result compared to what should be in this case is even 146+56 / 56 = 360% error on the RESULT

the percentage of failure on the daily income is in this case 146+56 / 1473 = 13,7% (this actually represents the rounding error, if it is a rounding error! Might as well be some other error)

The percentage of failure on the absolute total treasure is 202/451544 = 0,04473% (this rate says nothing really. as I explained in my previous post.)

Because if my treasure were 202, by your logic the rate of error would already be 100%!!!!

and if my treasure were unlimited you'd claim literally you have absolutely no rounding error (which is impossible because every CPU on this planet has rounding errors, I believe 16 digits after the comma, but was a long time ago I learned this in programming class so don't kill me if by now they fixed that and

get more accurate calculations from the cpu)

I really hope you see what you're doing wrong in the LOGIC, although your math is correct. Because you are wrong And I'll debate as long until you see the light.

In the end, just look at the numbers you presented yourself.

income-expenses ALWAYS positive!!!

Trade positive!!!

How on earths name can't you see when positive + positive = negative there is something utterly wrong with the logic!

negative TIMES negative makes positive.. But there is NO MATHEMATICAL LOGIC that positive PLUS positive would result in negative.

You're math is correct but your logic is wrong. We can't argue about the math if you use the wrong logic ..

wrong logic = wrong input and wrong assumption.

So if you can't see the logic, look at the numbers...

every single day you can clearly see the income is BIGGER then the expense!!!

Every single day you can clearly see the TRADE is PLUS!

But every single day the treasury is going down!

And you fail to recognize your logic is wrong :(

You do the % on the wrong logic.

You are doing the error rate on the total treasury and claim that's 0,04% and thus small and thus not noticeble and that's wrong.

What you should do is calculate the wrong value on what should have been changed.. that's the error %

let's have a look at juli 8. The treasury is 451.544 and should become on juli 9: +1473-1459+31,04-0,06+11,42 = 451.600,04 )

but you actually got on July 9: 451.454,00

Thus missing is 146,40

The correct changed value would be 451.600,04 - 451.544 = 56.04 (plus)

but we have 146 (minus)

so the percentage of wrong result compared to what should be in this case is even 146+56 / 56 = 360% error on the RESULT

the percentage of failure on the daily income is in this case 146+56 / 1473 = 13,7% (this actually represents the rounding error, if it is a rounding error! Might as well be some other error)

The percentage of failure on the absolute total treasure is 202/451544 = 0,04473% (this rate says nothing really. as I explained in my previous post.)

Because if my treasure were 202, by your logic the rate of error would already be 100%!!!!

and if my treasure were unlimited you'd claim literally you have absolutely no rounding error (which is impossible because every CPU on this planet has rounding errors, I believe 16 digits after the comma, but was a long time ago I learned this in programming class so don't kill me if by now they fixed that and

get more accurate calculations from the cpu)

I really hope you see what you're doing wrong in the LOGIC, although your math is correct. Because you are wrong And I'll debate as long until you see the light.

In the end, just look at the numbers you presented yourself.

income-expenses ALWAYS positive!!!

Trade positive!!!

How on earths name can't you see when positive + positive = negative there is something utterly wrong with the logic!

negative TIMES negative makes positive.. But there is NO MATHEMATICAL LOGIC that positive PLUS positive would result in negative.

### Re: Money negative while surplus

[Edit] - I missed your first of two posts, I'm out of order on my replies, will catch up...

The "income" value is an estimate of the changes that will be applied to the treasury. The formula isn't "treasury + total income" it is "treasury + every single little income".

And until we're talking about values greater than a zero point zero four percent change in your total treasury, it will not be a high enough priority to get more attention.

I'll keep reading...

Only read this far, will keep reading, but you've missed a key part of the system.

The "income" value is an estimate of the changes that will be applied to the treasury. The formula isn't "treasury + total income" it is "treasury + every single little income".

And until we're talking about values greater than a zero point zero four percent change in your total treasury, it will not be a high enough priority to get more attention.

I'll keep reading...

### Re: Money negative while surplus

No, because if your treasury was 1,000,000,000,000,000,000,000,000,000 you would get a much larger error and if your treasury was 202,000,000 you would barely get any error.

You insist on using Income/Expenses. I still stand by the total treasury is what should be compared. That's what George asks me for when I bring concerns.

We'll have to agree to disagree. I still see this as low priority.

### Re: Money negative while surplus

Even small percent values unfortunately mean something , that's why even growth % numbers have decimal values.

Look at my example in that link with as you would write "only 0,29207%" unaccounted/lost treasury - if that happens 343 days then my complete treasury is gone.

Even using your little excuse with those nice 0,04% and your treasury would be depleted in less than 7 years - unfortunately - the unaccounted for % of your treasury can be quit higher.

Not to mention that its useless to compare this error to the amount of treasure - the unaccounted$ per day have to be compared against the profits per day and here were are talking about triple-digit%.

Please ask your tax auditor what he would think when you would revalue your business assets for the tax year by only 14,6% (0,04%*365) and change the report of your profits by -163% (like in my calculation from profit 57081$ to a loss of 93059$)

https://www.google.com/search?q=penalti ... 8&oe=utf-8

Look at my example in that link with as you would write "only 0,29207%" unaccounted/lost treasury - if that happens 343 days then my complete treasury is gone.

Even using your little excuse with those nice 0,04% and your treasury would be depleted in less than 7 years - unfortunately - the unaccounted for % of your treasury can be quit higher.

Not to mention that its useless to compare this error to the amount of treasure - the unaccounted$ per day have to be compared against the profits per day and here were are talking about triple-digit%.

Please ask your tax auditor what he would think when you would revalue your business assets for the tax year by only 14,6% (0,04%*365) and change the report of your profits by -163% (like in my calculation from profit 57081$ to a loss of 93059$)

https://www.google.com/search?q=penalti ... 8&oe=utf-8

my mods

http://www.bgforums.com/forums/viewtopi ... 79&t=25932 (even techs and units for everyone - AI will own you too)

http://www.bgforums.com/forums/viewtopi ... 79&t=29326 (MARSX2)

http://www.bgforums.com/forums/viewtopi ... 79&t=25932 (even techs and units for everyone - AI will own you too)

http://www.bgforums.com/forums/viewtopi ... 79&t=29326 (MARSX2)

### Re: Money negative while surplus

I agree with you that even if it is a small number it does mean something. The issue is that changing the way calculations are done also means something, and we had to decide which one we felt was more impact on the game experience.

Your complete treasury would never be "gone" as the calculations is done daily(and the amount lost changes as well as it is fractional), at complete economy stagnation you would lose less and less each day until the error no longer occurs.

You should ask your tax auditor how to do complex single floating point math without the loss of any significant figures. Changing these operations to use a different data structure (double floating point, etc) has a negative impact on game performance as we are effectively doubling the amount of memory needed for the calculations(of which there are so many that I doubt most players realize the crazy number of calculations being done).evildari wrote: ↑Jul 27 2018Please ask your tax auditor what he would think when you would revalue your business assets for the tax year by only 14,6% (0,04%*365) and change the report of your profits by -163% (like in my calculation from profit 57081$ to a loss of 93059$)

https://www.google.com/search?q=penalti ... 8&oe=utf-8

While I completely agree with you about money missing from the treasury, and as a player would like to see the issue solved(even if it doesn't bother me personally). I understand as a software developer the increase in memory that would accompany a change like this and stand by the earlier decision made by Balthagor that it is low priority.

### Re: Money negative while surplus

I mean, this game runs a crapton of calculations. We used to struggle with major slowdowns that made every in game day take a very long time to process. They've been trying to find ways to minimize that and have succeeded in reducing the load so that we can get more reasonable game speed. If we start undoing those improvements, then we're going to have to pay for it with significant reductions in game speed. I think it really boils down to having one or the other, but trying to have both just isn't something we can have right now.

### Re: Money negative while surplus

Int64 max value is 9,223,372,036,854,775,807

that's a treasury of 9,223,372 trillion!

you aren't doing cents in the game..

So why floating point? Int64 can cover it pretty well. No value in the game would go that high.

US yearly GDP is around 19 trillion in 2018.

and we're talking here about a total treasure of 9 million-trillion. Also known as 9 Quintillion.

There's just NO WAY any country could save up that much between 1900 - 2050

So you could just use the in64 instead of float and have a rounding error of 0% if using int64 everywhere.

Also, it doesn't change the fact that the rounding error even on the total treasure isn't static like 0,04%

And it doesn't change the fact that a country running positive on all fronts would be negative just of rounding errors.

If I make a profit of 100 Million a day and tell the tax office: I loose 50 Million a day..

You know what they do to me? 7 years prison for starters. that's the minimum sanction..

and then tons of burocrats will come and check through all the papers where I'm lying and that will go to court and

by these huge sums..

it would be like Apple claiming they make losses every single year because of rounding errors..

imagine that.. just because companies grow larger, they can work tax-free!!

that's a treasury of 9,223,372 trillion!

you aren't doing cents in the game..

So why floating point? Int64 can cover it pretty well. No value in the game would go that high.

US yearly GDP is around 19 trillion in 2018.

and we're talking here about a total treasure of 9 million-trillion. Also known as 9 Quintillion.

There's just NO WAY any country could save up that much between 1900 - 2050

So you could just use the in64 instead of float and have a rounding error of 0% if using int64 everywhere.

Also, it doesn't change the fact that the rounding error even on the total treasure isn't static like 0,04%

And it doesn't change the fact that a country running positive on all fronts would be negative just of rounding errors.

If I make a profit of 100 Million a day and tell the tax office: I loose 50 Million a day..

You know what they do to me? 7 years prison for starters. that's the minimum sanction..

and then tons of burocrats will come and check through all the papers where I'm lying and that will go to court and

by these huge sums..

it would be like Apple claiming they make losses every single year because of rounding errors..

imagine that.. just because companies grow larger, they can work tax-free!!

### Re: Money negative while surplus

If you do the few calculations that are involved with finances in int64 you actually unload parts of the CPU because that's done elsewhere and free up float performance for other tasks.way2co0l wrote: ↑Jul 27 2018I mean, this game runs a crapton of calculations. We used to struggle with major slowdowns that made every in game day take a very long time to process. They've been trying to find ways to minimize that and have succeeded in reducing the load so that we can get more reasonable game speed. If we start undoing those improvements, then we're going to have to pay for it with significant reductions in game speed. I think it really boils down to having one or the other, but trying to have both just isn't something we can have right now.

Not to mention, this game runs highly multi threading (and that's awesome, bg was a visionary in the field of strategy gaming on this part!!)

actually supreme ruler is the best strategy game on the market anyway..

I just feel, because it's the best.. I want it to become perfect! I know that's impossible. Being programmer myself I know perfection is not possible...

but you can strive for it!

Anyway, back in 2012 we were all running 4 cores, hyperthreading best..

unless you have some 2000 USD server CPU for playing a game. I had these strong CPU but not allowed to use them for game play LOL

Today Intel is on the verge of releasing the i9-9900k, a 16 threading, 8 core, 5Ghz monster with soldered heat-plate that can possibly be overclocked to

5Ghz on all 6 cores and 5.3 Ghz on the 2 main cores..

You know what that means? That beast will simply be 4 or 6 times faster then an i7-7700k we had 2 or 3 years ago.

And with Zen2 coming up in spring next year, I wouldn't put it past AMD to go 12 core and 24 threading forcing intel to beat that again..

this game is made for the future of multi-threading.. but if you go int64, that's not necessary I think.. not sure about other values in game but I doubt they are loading a lot of integers

calculations onto the CPU.. looks to me like almost everything is a floating point operation.

### Re: Money negative while surplus

I'll have to take your word on that because the honest truth is that I definitely don't have that programming expertise. I know enough to have a basic understanding which is why I feel like I can understand certain complexities they have to deal with, but I definitely don't know enough to weigh in on something like that, so I'll defer to you guys to sort that part out. haha.mrgenie wrote: ↑Jul 28 2018If you do the few calculations that are involved with finances in int64 you actually unload parts of the CPU because that's done elsewhere and free up float performance for other tasks.way2co0l wrote: ↑Jul 27 2018I mean, this game runs a crapton of calculations. We used to struggle with major slowdowns that made every in game day take a very long time to process. They've been trying to find ways to minimize that and have succeeded in reducing the load so that we can get more reasonable game speed. If we start undoing those improvements, then we're going to have to pay for it with significant reductions in game speed. I think it really boils down to having one or the other, but trying to have both just isn't something we can have right now.

Not to mention, this game runs highly multi threading (and that's awesome, bg was a visionary in the field of strategy gaming on this part!!)

actually supreme ruler is the best strategy game on the market anyway..

I just feel, because it's the best.. I want it to become perfect! I know that's impossible. Being programmer myself I know perfection is not possible...

but you can strive for it!

I do agree wholeheartedly with you on wanting the game to be the best that it can be. Like, I'm not sure if you've seen how many suggestions I've personally made over the years. haha. I don't blame you for pointing things out and trying to make things better. That's how the game got as good as it has already. Caring enough to provide feedback, whether we get what we want from it or not (quite a few of my suggestions never went anywhere) and accepting the limitations that the devs are working with while trying to get the most out of the resources we have that we can. If I ever seem argumentative or like I'm trying to shut your suggestions down or anything, I can assure you it's not the case. Sometimes thorough discussion is what's necessary to lead to changes being well thought out and done right.

### Re: Money negative while surplus

The problem is it is not the % of the treasury that is missing - it is an absolute value that is gone.

Its not the same % of a lower value but still the amount like half year before and my old treasury is half high , and that half year ago measly 0,29% loss amounts now to almost 0,58% per day compared to current Treasury. That's the reason why i said calculating this % in relation to the treasury does not make sense.

For your excuse to the tax auditors, others already wrote what i think about it...

But most of the calculations were already done , i just used the provided numbers (assumed they are correct) ,adding those up and the game does not add to the same values that i have calculated with a spreadsheet program. So the big though calculations were already done and only the final puny treasury calculation needs done:

I.e.: if you would update the Treasury of 200 regions , 24 times a day this would amount to 4800 Calculations of the treasury in the time it takes to complete a gameday (ill assume a way higher cpu than my and use the simple value of 1) .. so 4800 calculations using several additions of previously calculated positive and negative values... that was already doable on a Motorla 68000 CPU (around 7-8Mhz - around one million operations per second)

my mods

http://www.bgforums.com/forums/viewtopi ... 79&t=25932 (even techs and units for everyone - AI will own you too)

http://www.bgforums.com/forums/viewtopi ... 79&t=29326 (MARSX2)

http://www.bgforums.com/forums/viewtopi ... 79&t=25932 (even techs and units for everyone - AI will own you too)

http://www.bgforums.com/forums/viewtopi ... 79&t=29326 (MARSX2)

### Re: Money negative while surplus

way2cool.. I never taken your comments as insult or playing things down or negative in any way...

for me a forum like this is to brainstorm on issues playings think can be improved..

usually having 100 opinions and 100 ideas is a lot better then just 1 idea and everyone just nodding

I tend to just write what I think, even if I 1 minute later think: oh, that could be done better, I just let it stand for what it is because mistakes in arguments do help others by seing the mistake

to come up with maybe other ideas to improve things or do it better.

I strongly support brainstorming just throw it out first..

and then we start the discussion on sense, nonsense, etc.. filter it down to the best .. and that usually starts with the worst to get to the best

for me a forum like this is to brainstorm on issues playings think can be improved..

usually having 100 opinions and 100 ideas is a lot better then just 1 idea and everyone just nodding

I tend to just write what I think, even if I 1 minute later think: oh, that could be done better, I just let it stand for what it is because mistakes in arguments do help others by seing the mistake

to come up with maybe other ideas to improve things or do it better.

I strongly support brainstorming just throw it out first..

and then we start the discussion on sense, nonsense, etc.. filter it down to the best .. and that usually starts with the worst to get to the best

### Re: Money negative while surplus

ehm no..evildari wrote: ↑Jul 28 2018I.e.: if you would update the Treasury of 200 regions , 24 times a day this would amount to 4800 Calculations of the treasury in the time it takes to complete a gameday (ill assume a way higher cpu than my and use the simple value of 1) .. so 4800 calculations using several additions of previously calculated positive and negative values... that was already doable on a Motorla 68000 CPU (around 7-8Mhz - around one million operations per second)

because every variable is depending on other variables we can't know how many calculations that is, only the programmer knows.

We could know it with open source.

10+10+10+10 = 40 wouldn't be 1 calculation.. on a CPU.

Just A + B if I remember correct are 3 operations in assembler. mov, mov and add in assembler..

that's 3 operations..

So the above example would be 12 operations

so for 200 countries that would be 2400 operations just for summarize 4 values.

but operation != calculation

I think c++ for such operations using the same amount as assembler if I'm right, at least a good compiler would do that.

1 operation like mov reserves an register

so you have 2 registers with the value in either 32bit or 64 bit

and the add might actually put 1 value as a memory location instead of 2 registers

I'm not sure how many calculations the CPU would do.. but 1+1 would just be a few transistors opening and closing..so that might

be doable within just very few "calculations" on a good compiler.

the moment you get something like 5+5 you get a 10 and now the values are "shifted" not sure if that's the correct word through the bits reserved in the register

and the 1 comes from the shift of the overflow.

I don't know exactly how many operations and transistors are involved in it. They explained it once in programming class 20 years ago LOL

It was very interesting and if you asked me that 20 years ago I could have answered..

Today i don't know! I know how to use the CPU and programming language but the underlying stuff I forgot already since I never used it.

But what did remain, is the knowledge that the CPU doesn't just work like 1+1= 2 like we do..

it opens the register like (let's keep it simple opening 4bit register on a 4bit cpu) 0001 + 0001 = the two 1 shift one place and you get 0010

if you do more complex numbers more shifting is done and thus more "calculations"

So you can't just say value A + value B = 1 calculations..

you already need "calculations" on the CPU to open a register, put the value there.. in all its 0 and 1...

you do that for the 2nd value..

now you start "shifting" "moving" "adding" whatever it's called in english.

another example 4 bit: 1111 + 0001 =

1110 + 0010 = 1100 + 0100 = 1000 + 1000 = 10000 (so you already need at least 5bit, thus a 8bit chip, but that's not the point.. point is

to do 15+ 1 = 16 in the above example you already need to ask your CPU to open 2 registers..

do 4 shifting within the register..

for every task you need a few "calculations" it's not called a calculation but I'm not sure in English how you call it, maybe just operations?

and all of that for just 1 single command "add"

So taking that into account.. the above example with 200 regions might as well be over 100.000 "calculations" for the CPU for just adding the

final values..

but each of them will be the sum of smaller calculations.. like all currently under construction add up to 1 single part of the total expenses..

well I think you get the idea..

that's why BG went for "accepting rounding errors" since they do everything in float.. the more accurate you make the float, the more actual calculations your CPU needs to do.

and it's not a linear increase in math I can tell you that for sure.

that's why I think, doing the economical stuff with Int64 would be faster..

But I might be wrong. game programming isn't my profession. Engineering is, mechanical, just learned programming simulation techniques and financial programs as well

as some other smaller stuff along the way...

But I do know enough to at least point out "maybe.. you could do it like that or this..." bringing up ideas isn't bad I think.

They can always just ignore it and skip it

### Re: Money negative while surplus

Another argument against this huge deficit caused by "rounding"

Why is the rounding always resulting in losing money?

If it really were a rounding issue, a true rounding issue, why is it never rounded up?

values ,5 should result in excess of money if that's the case

and another argument:

if I already, like in your excel example, got a total value which I show to the user which is 50 or 100 or 150 Million per day PLUS..

the rounding should be visible here as well!

I could simply except what I show to the user already holds any rounding error..

so the next day math.. I just do what you did in your excel:

sum of the already rounded numbers I show the user.

That way, what the user SEE is what he WILL HAVE next day.

So if you run negative, the User will know and can respond to it accordingly to make sure not going bankrupt.

But again, I doubt this is a rounding issue. It's somewhere in the code a logic issue.

a logical decision made wrong that gives you daily losses of millions.. while showing the user daily profit of millions.

Why is the rounding always resulting in losing money?

If it really were a rounding issue, a true rounding issue, why is it never rounded up?

values ,5 should result in excess of money if that's the case

and another argument:

if I already, like in your excel example, got a total value which I show to the user which is 50 or 100 or 150 Million per day PLUS..

the rounding should be visible here as well!

I could simply except what I show to the user already holds any rounding error..

so the next day math.. I just do what you did in your excel:

sum of the already rounded numbers I show the user.

That way, what the user SEE is what he WILL HAVE next day.

So if you run negative, the User will know and can respond to it accordingly to make sure not going bankrupt.

But again, I doubt this is a rounding issue. It's somewhere in the code a logic issue.

a logical decision made wrong that gives you daily losses of millions.. while showing the user daily profit of millions.

### Re: Money negative while surplus

Yes Int64 would be better, but again more memory would be needed. Single floating point fits into 32 bits. Int64 as the name implies would be twice the memory at 64 bits, and that is per number used not just numbers the user sees.

And there are 1440 game slices per game day at which calculations can be done. What you see at day end is a "sum" of all the calculations done in the background. Mrgenie is completely correct in saying that you cannot just declare it as 4800 operations per day when you do not understand the underlying formulas and even how computer math is done. Not to mention the fact that there is so much more to the game than treasury calculations and every single thing happening takes up system resources. It is simple to say "do it this way" it gets much more complicated trying to implement that without negatively impacting the games performance.

And there are 1440 game slices per game day at which calculations can be done. What you see at day end is a "sum" of all the calculations done in the background. Mrgenie is completely correct in saying that you cannot just declare it as 4800 operations per day when you do not understand the underlying formulas and even how computer math is done. Not to mention the fact that there is so much more to the game than treasury calculations and every single thing happening takes up system resources. It is simple to say "do it this way" it gets much more complicated trying to implement that without negatively impacting the games performance.