I am deleting 2 numbers but o/pt is getting rounded and i dont want it be rounded.
Math.pow (10, 14) - Math.pow(10, -6) = 1 000 000 000 000 00
But i want the o/p 999 999 999 999 99.99 99 99
Can anyone help?
Edited by: gogiB on May 23, 2013 7:46 AM
Edited by: gogiB on May 23, 2013 8:02 AM
It's interesting. I have a calculator that uses BigDecimal. When I use it to multiply ( (10^9) - (10^-6) ) ... it does the right thing. But when I raise the first to the power of 10 instead of 9, then it does not. In both cases 10^-6 produces .000001, but in the subtraction with the later it breaks down. I didn't complete my code review yet to see why, but with BigDecimal.subtract I know that is the MathContext is ommitted - which it is in my case - the scale is determined by the larger "scale" of the two numbers.
The OP did not mention how the calculation was performed, so I don't know if this information is of any value or not.
Edited by: abillconsl on May 23, 2013 11:55 AM