Is there a way to get exact value for division operation like 1/24 to get exact value as
1/24 = 0.04166666666
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityJust use a decimal. You can use the divide
method if you want to specify a number of digits.
system.assertEquals(0, 1/24);
system.assertEquals(0.0416666666666666666666666666666667, 1.0/24);
system.assertEquals(0.04167, 1.0.divide(24, 5));