I m finding that i m needing to compute large numbers to high precision. For example: 5422300.8452. What is the best way to store this data so that simple arithmetic operators can act on it? I ve been trying to do combinations of Longs and Doubles but it gets complicated after a significant number of computations. I m sure there is a simple solution, i m just not so knowledgeable yet.
Ok Basically, I figured it out: My problem was that I wanted to keep 4 decimal places of precision but entering a high number started truncating digits. For example, I had this:
Double Remain = (double) Math.round((double quantity/12)*10000)/10000;
这一数字较小,但9 000 000人仍然被拖到7.5件。
So I basically need to divide the numbers as long and then take the modulus of the 2 and divide it by the denominator, and round the result. Then add the 2.
工作!