I have issue that I want to round the double data type to two decimal places.
I am writing the below apex code to do that but not working.
public Double APR_system_Volume_with_Racking_m3_Annual{get;set;}
APR_system_Volume_with_Racking_m3_Annual = ((dBBU_in_MBU * dTotal_Volume_BBU_m3) + dTotal_Volume_MBU_m3)* dMBU;
i = APR_system_Volume_with_Racking_m3_Annual * 10;
APR_system_Volume_with_Racking_m3_Annual = Math.round(i);
APR_system_Volume_with_Racking_m3_Annual = APR_system_Volume_with_Racking_m3_Annual /10;
Still my variable APR_system_Volume_with_Racking_m3_Annual showing value like 33737.670000000006 in my visual force page. I want to format that value in apex not in visual force outputtext formatting like
<apexutputText value="{0, number, 000,000.00}">
<apexaram value="{!Account.AnnualRevenue}" />
</apexutputText>
Best Answer
In Apex try the following code. I hope this should work.