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
Dhatri Nath KodaliDhatri Nath Kodali 

Need help in writing APEX Class with ModulusOperator having integer and double

public class MOperators              {
      public void main()          {

            integer x =  42       ;
            double y =  42.25  ;

     system.debug('x MOD 10 = ' + math.mod (x,10));
     system.debug('y MOD 10 = ' + math.mod (y,10));

       }

}

 
Dhatri Nath KodaliDhatri Nath Kodali
Is it possible to use Mod operator for 'double' ?
ChellappaChellappa
Please refer to the documentation for Math class.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_math.htm

mod method takes two Long parameters. 
Raj VakatiRaj Vakati
Its support only Integer and Long 


Its MOD operation not support double .. please refer this link 


Refer this link 

https://developer.salesforce.com/forums/ForumsMain?id=9062I000000g4nuQAA
 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_math.htm


public static Integer mod(Integer integerValue1, Integer integerValue2)


public static Long mod(Long longValue1, Long longValue2)