You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LiteralsCf.java 1.0KB

1234567891011121314151617181920212223242526272829303132333435
  1. public class LiteralsCf {
  2. public static void main(String[] args) {
  3. float f;
  4. double d;
  5. f = 3.4028235e+38f; //Why not error?
  6. f = 1.4023983e-45f; //Why not error?
  7. f = 1e39f; //ERR: rounds to +INF
  8. f = 0.0000000000000000000000000000000000000000000000001f; //ERR: rounds to 0
  9. f = -1234567890123456789012345678901234567890123f; //ERR: rounds to -INF
  10. d = -1e310; //ERR: rounds to -INF
  11. d = 1e500; //ERR: rounds to +INF
  12. int i, i1, i2, i3;
  13. long l, l1, l2, l3;
  14. i = 2147483648; //ERR: too big
  15. i = 0x1ffffffff; //ERR: too big
  16. i = 01234567012345670; //ERR: too big
  17. i2 = 0x800000000;
  18. i3 = 0200000000000;
  19. i2 = 0x100000000;
  20. i3 = 040000000000;
  21. i = -2147483649; //ERR: too small
  22. l = 9223372036854775808L; //ERR: too big
  23. l = -9223372036854775809L; //ERR: too small
  24. l2 = 0x80000000000000000L;
  25. l3 = 010000000000000000000000L;
  26. i = 09; //ERR: illegal octal
  27. }
  28. }