package math.number;


/*************************************************************************
 *  Compilation:  javac NegativeZero.java
 *  Execution:    java NegativeZero
 *
 *  In Java, x = 0.0 and y = -0.0 are two different representations of zero.
 *  It is true that (x == y). But, (1/x == 1/y) is not true.
 *  
 *  % java Zero
 *  no
 *
 *************************************************************************/

public class NegativeZero {

   public static void main(String[] args) { 
      double x =  0.0;
      double y = -0.0;
      System.out.println("x = " + x);
      System.out.println("y = " + y);
      System.out.println("(x == y) is " + (x == y));

      double a = 1.0 / x;
      double b = 1.0 / y;
      System.out.println("1/x = " + a);
      System.out.println("1/y = " + b);
      System.out.println("(1/x == 1/y) is " + (a == b));
   }

}
