Golang arithmetic error

(Caleb David) #1

Golang arithmetic error

(Norbert Melzer) #2

Please describe your problem in the post, it took me a while to figure that that it was hidden in the code via comments…

-100 is less then the current balance of 200, so it gets subtracted, 200 - -100 is equivalent to 200 + (-1 * -100) which is 200 + 100, so 300 is the correct result.

(Caleb David) #3

Sorry about that. My bad, I’ve figured out the solution.

(system) closed #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.