jdk/src/share/classes/java/lang/Double.java
changeset 15311 be0ff4a719bf
parent 14507 066419d1e732
child 15525 0308cc37489b
equal deleted inserted replaced
15310:77bdd8c8467e 15311:be0ff4a719bf
  1019         return (thisBits == anotherBits ?  0 : // Values are equal
  1019         return (thisBits == anotherBits ?  0 : // Values are equal
  1020                 (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)
  1020                 (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)
  1021                  1));                          // (0.0, -0.0) or (NaN, !NaN)
  1021                  1));                          // (0.0, -0.0) or (NaN, !NaN)
  1022     }
  1022     }
  1023 
  1023 
       
  1024     /**
       
  1025      * Adds two {@code double} values together as per the + operator.
       
  1026      *
       
  1027      * @param a the first operand
       
  1028      * @param b the second operand
       
  1029      * @return the sum of {@code a} and {@code b}
       
  1030      * @jls 4.2.4 Floating-Point Operations
       
  1031      * @see java.util.function.BinaryOperator
       
  1032      * @since 1.8
       
  1033      */
       
  1034     public static double sum(double a, double b) {
       
  1035         return a + b;
       
  1036     }
       
  1037 
       
  1038     /**
       
  1039      * Returns the greater of two {@code double} values
       
  1040      * as if by calling {@link Math#max(double, double) Math.max}.
       
  1041      *
       
  1042      * @param a the first operand
       
  1043      * @param b the second operand
       
  1044      * @return the greater of {@code a} and {@code b}
       
  1045      * @see java.util.function.BinaryOperator
       
  1046      * @since 1.8
       
  1047      */
       
  1048     public static double max(double a, double b) {
       
  1049         return Math.max(a, b);
       
  1050     }
       
  1051 
       
  1052     /**
       
  1053      * Returns the smaller of two {@code double} values
       
  1054      * as if by calling {@link Math#min(double, double) Math.min}.
       
  1055      *
       
  1056      * @param a the first operand
       
  1057      * @param b the second operand
       
  1058      * @return the smaller of {@code a} and {@code b}.
       
  1059      * @see java.util.function.BinaryOperator
       
  1060      * @since 1.8
       
  1061      */
       
  1062     public static double min(double a, double b) {
       
  1063         return Math.min(a, b);
       
  1064     }
       
  1065 
  1024     /** use serialVersionUID from JDK 1.0.2 for interoperability */
  1066     /** use serialVersionUID from JDK 1.0.2 for interoperability */
  1025     private static final long serialVersionUID = -9172774392245257468L;
  1067     private static final long serialVersionUID = -9172774392245257468L;
  1026 }
  1068 }