Applying the modulus operator, %, to floating-point values : Arithmetic Operators « Operators « Java Tutorial






public class MainClass{

  public static void main(String[] arg){
     double a = 2.4;
     double b = 0.2;
     
          
     System.out.println( a % b );
  }

}
0.1999999999999998








3.4.Arithmetic Operators
3.4.1.Arithmetic Calculations
3.4.2.Arithmetic Operators
3.4.3.The Basic Arithmetic Operators
3.4.4.Demonstrates the mathematical operators
3.4.5.Modulus operator %: obtain the remainder after a division
3.4.6.Applying the modulus operator, %, to floating-point values