Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created September 2, 2017 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcrichton/cfadf366b00f7ca9a78ddc6c1fb1437d to your computer and use it in GitHub Desktop.
Save alexcrichton/cfadf366b00f7ca9a78ddc6c1fb1437d to your computer and use it in GitHub Desktop.
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
System.out.format(" 257.0 -> i32 = %d\n", (int) 257.0);
System.out.format("-257.0 -> i32 = %d\n", (int) -257.0);
System.out.format(" MAX+1 -> i32 = %d\n", (int) 2147483648.0);
System.out.format(" MIN-1 -> i32 = %d\n", (int) -2147483649.0);
System.out.format("-0.0 -> i32 = %d\n", (int) -0.0);
System.out.format(" Inf -> i32 = %d\n", (int) (1.0/0.0));
System.out.format("-Inf -> i32 = %d\n", (int) (-1.0/0.0));
System.out.format(" NaN -> i32 = %d\n", (int) (0.0/0.0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment