fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. System.out.format(" 257.0 -> i32 = %d\n", (int) 257.0);
  10. System.out.format("-257.0 -> i32 = %d\n", (int) -257.0);
  11. System.out.format(" MAX+1 -> i32 = %d\n", (int) 2147483648.0);
  12. System.out.format(" MIN-1 -> i32 = %d\n", (int) -2147483649.0);
  13. System.out.format("-0.0 -> i32 = %d\n", (int) -0.0);
  14. System.out.format(" Inf -> i32 = %d\n", (int) (1.0/0.0));
  15. System.out.format("-Inf -> i32 = %d\n", (int) (-1.0/0.0));
  16. System.out.format(" NaN -> i32 = %d\n", (int) (0.0/0.0));
  17. }
  18. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
 257.0 -> i32 = 257
-257.0 -> i32 = -257
 MAX+1 -> i32 = 2147483647
 MIN-1 -> i32 = -2147483648
-0.0   -> i32 = 0
 Inf   -> i32 = 2147483647
-Inf   -> i32 = -2147483648
 NaN   -> i32 = 0