I have a contract (code above) where ether is bet on either side 0 or side 1. A winning side is determined (payout function), and the amount of ether that a winner will receive is determined by this formula:
(amount wei winner bet/amount of wei in winning pool)*(amt. of wei in winning pool + amt. of wei in losing pool)
The problem is that sometimes the formula will give a value of 0 when run on the contract when it doesn't in real life causing nobody to be paid. What's the best way to distribute the amount of ether that a winner deserves?