I have a simple calculation on double values in a java program.
double blockNetMoney=1239891.632;
double blockQty=1120000;
double allocQty=150000;
BigDecimal allocNetMoney = new BigDecimal(String.valueOf((allocQty/blockQty)*blockNetMoney));
System.out.println("AllocNetMoney:"+allocNetMoney );
I'm getting a value 166056.91499999998
for Alloc Net money.
But correct value is 166056.915
and i get that value when i use a calculator or excel.
Can you please suggest what changes i need to make to get the value 166056.915