function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
csreddy7799csreddy7799 

Ceiling of Number

hi all,

 

 How to use CEILING in apex controller. 

For Ex: i want to use 1.1 as 2 in my calculation . how can i acheive this?

jayjaysjayjays

Hi,

 

you can use the round method on a decimal instance, for example;

 

decimal d=1.1;
integer i;
i=(integer)d.round(system.RoundingMode.CEILING);
system.debug(i);

 see here for the documentation on the rounding modes;

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_decimal.htm#apex_decimal_rounding_mode

 

Thanks,

James.