double inf = Double.POSITIVE_INFINITY; System.out.println(inf + 5); System.out.println(inf - inf); // same as Double.NaN System.out.println(inf * -1); // same as Double.NEGATIVE_INFINITY