I have a rollup field on the Quote object. When I access that value in my VF page controller, I'm seeing its value getting truncated there. Because of this when I'm seeing less amount on my VF page.
The rollup field value is getting calculated from the formula field of currency type of the quote line item.
When I query this field in developer console, I see full value
Eg: Value in UI and developer Console : 2950
Value in Controller: 2949.999999999999999999999999999999999998
Query I'm using Quote quoteRecord = [SELECT Id, Total__c FROM Quote WHERE Id =: quoteId];
Integer totalAfterDiscount = (Integer)quoteRecord.Total__c
totalAfterDiscount = 2949
I know, I can use rounding methods like round(System.RoundingMode.CEILING)) to get the value back to 2950.
But I want to understand what is causing this value to truncate, I mean change value to 2949.999999999999999999999999999999999998
One thing which I noticed is that when my currency is USD (which is default org currency) I'm not getting this issue. but when my currency is GBP that time I'm getting this issue.