fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. float a = 3.1415f;
  13. float b = 3.1414999961853027f;
  14.  
  15. System.out.println("a = " + a);
  16. System.out.println("b = " + b);
  17. System.out.println(a == b);
  18.  
  19. double c = a;
  20.  
  21. System.out.println("c = " + c);
  22. System.out.println(a == c);
  23. System.out.println(3.1414999961853027f == 3.1415f);
  24. System.out.println(3.1414999961853027d == 3.1415f);
  25. }
  26. }
Success #stdin #stdout 0.05s 320576KB
stdin
Standard input is empty
stdout
a = 3.1415
b = 3.1415
true
c = 3.1414999961853027
true
true
true