+ Start a Discussion
sfg1sfg1 

math.round issue.

 decimal Lowval = math.round(42.5);
 system.debug('Lowval '+Lowval ); 

 O/p - Lowval 42
     
 But correct result is 43.. what is the issue? Please help me
Gokula KrishnanGokula Krishnan
Hi sfg1,

When there is two digit in decimal, getting 43. If it is one digit in decimal, the system is taking 42.

Eg.1:
Decimal Lowval = Math.round(42.51); 
system.debug('Lowval== '+Lowval ); 
O/p - Lowval 43

Eg.2:
Decimal Lowval = Math.round(42.6); 
system.debug('Lowval== '+Lowval ); 
O/p - Lowval 43

Thanks,