1137 * @return the larger of {@code a} and {@code b}.
1138 */
1139 public static long max(long a, long b) {
1140 return Math.max(a, b);
1141 }
1142
1143 /**
1144 * Returns the greater of two {@code float} values. That is,
1145 * the result is the argument closer to positive infinity. If the
1146 * arguments have the same value, the result is that same
1147 * value. If either value is NaN, then the result is NaN. Unlike
1148 * the numerical comparison operators, this method considers
1149 * negative zero to be strictly smaller than positive zero. If one
1150 * argument is positive zero and the other negative zero, the
1151 * result is positive zero.
1152 *
1153 * @param a an argument.
1154 * @param b another argument.
1155 * @return the larger of {@code a} and {@code b}.
1156 */
1157 public static float max(float a, float b) {
1158 return Math.max(a, b);
1159 }
1160
1161 /**
1162 * Returns the greater of two {@code double} values. That
1163 * is, the result is the argument closer to positive infinity. If
1164 * the arguments have the same value, the result is that same
1165 * value. If either value is NaN, then the result is NaN. Unlike
1166 * the numerical comparison operators, this method considers
1167 * negative zero to be strictly smaller than positive zero. If one
1168 * argument is positive zero and the other negative zero, the
1169 * result is positive zero.
1170 *
1171 * @param a an argument.
1172 * @param b another argument.
1173 * @return the larger of {@code a} and {@code b}.
1174 */
1175 public static double max(double a, double b) {
1176 return Math.max(a, b);
1177 }
1178
1179 /**
1180 * Returns the smaller of two {@code int} values. That is,
1181 * the result the argument closer to the value of
1182 * {@link Integer#MIN_VALUE}. If the arguments have the same
1183 * value, the result is that same value.
1184 *
1185 * @param a an argument.
1186 * @param b another argument.
1187 * @return the smaller of {@code a} and {@code b}.
1188 */
1189 @HotSpotIntrinsicCandidate
1190 public static int min(int a, int b) {
1191 return Math.min(a, b);
1192 }
1193
1194 /**
1202 * @return the smaller of {@code a} and {@code b}.
1203 */
1204 public static long min(long a, long b) {
1205 return Math.min(a, b);
1206 }
1207
1208 /**
1209 * Returns the smaller of two {@code float} values. That is,
1210 * the result is the value closer to negative infinity. If the
1211 * arguments have the same value, the result is that same
1212 * value. If either value is NaN, then the result is NaN. Unlike
1213 * the numerical comparison operators, this method considers
1214 * negative zero to be strictly smaller than positive zero. If
1215 * one argument is positive zero and the other is negative zero,
1216 * the result is negative zero.
1217 *
1218 * @param a an argument.
1219 * @param b another argument.
1220 * @return the smaller of {@code a} and {@code b.}
1221 */
1222 public static float min(float a, float b) {
1223 return Math.min(a, b);
1224 }
1225
1226 /**
1227 * Returns the smaller of two {@code double} values. That
1228 * is, the result is the value closer to negative infinity. If the
1229 * arguments have the same value, the result is that same
1230 * value. If either value is NaN, then the result is NaN. Unlike
1231 * the numerical comparison operators, this method considers
1232 * negative zero to be strictly smaller than positive zero. If one
1233 * argument is positive zero and the other is negative zero, the
1234 * result is negative zero.
1235 *
1236 * @param a an argument.
1237 * @param b another argument.
1238 * @return the smaller of {@code a} and {@code b}.
1239 */
1240 public static double min(double a, double b) {
1241 return Math.min(a, b);
1242 }
1243
1244 /**
1245 * Returns the fused multiply add of the three arguments; that is,
1246 * returns the exact product of the first two arguments summed
1247 * with the third argument and then rounded once to the nearest
1248 * {@code double}.
1249 *
1250 * The rounding is done using the {@linkplain
1251 * java.math.RoundingMode#HALF_EVEN round to nearest even
1252 * rounding mode}.
1253 *
1254 * In contrast, if {@code a * b + c} is evaluated as a regular
1255 * floating-point expression, two rounding errors are involved,
1256 * the first for the multiply operation, the second for the
1257 * addition operation.
1258 *
1259 * <p>Special cases:
|
1137 * @return the larger of {@code a} and {@code b}.
1138 */
1139 public static long max(long a, long b) {
1140 return Math.max(a, b);
1141 }
1142
1143 /**
1144 * Returns the greater of two {@code float} values. That is,
1145 * the result is the argument closer to positive infinity. If the
1146 * arguments have the same value, the result is that same
1147 * value. If either value is NaN, then the result is NaN. Unlike
1148 * the numerical comparison operators, this method considers
1149 * negative zero to be strictly smaller than positive zero. If one
1150 * argument is positive zero and the other negative zero, the
1151 * result is positive zero.
1152 *
1153 * @param a an argument.
1154 * @param b another argument.
1155 * @return the larger of {@code a} and {@code b}.
1156 */
1157 @HotSpotIntrinsicCandidate
1158 public static float max(float a, float b) {
1159 return Math.max(a, b);
1160 }
1161
1162 /**
1163 * Returns the greater of two {@code double} values. That
1164 * is, the result is the argument closer to positive infinity. If
1165 * the arguments have the same value, the result is that same
1166 * value. If either value is NaN, then the result is NaN. Unlike
1167 * the numerical comparison operators, this method considers
1168 * negative zero to be strictly smaller than positive zero. If one
1169 * argument is positive zero and the other negative zero, the
1170 * result is positive zero.
1171 *
1172 * @param a an argument.
1173 * @param b another argument.
1174 * @return the larger of {@code a} and {@code b}.
1175 */
1176 @HotSpotIntrinsicCandidate
1177 public static double max(double a, double b) {
1178 return Math.max(a, b);
1179 }
1180
1181 /**
1182 * Returns the smaller of two {@code int} values. That is,
1183 * the result the argument closer to the value of
1184 * {@link Integer#MIN_VALUE}. If the arguments have the same
1185 * value, the result is that same value.
1186 *
1187 * @param a an argument.
1188 * @param b another argument.
1189 * @return the smaller of {@code a} and {@code b}.
1190 */
1191 @HotSpotIntrinsicCandidate
1192 public static int min(int a, int b) {
1193 return Math.min(a, b);
1194 }
1195
1196 /**
1204 * @return the smaller of {@code a} and {@code b}.
1205 */
1206 public static long min(long a, long b) {
1207 return Math.min(a, b);
1208 }
1209
1210 /**
1211 * Returns the smaller of two {@code float} values. That is,
1212 * the result is the value closer to negative infinity. If the
1213 * arguments have the same value, the result is that same
1214 * value. If either value is NaN, then the result is NaN. Unlike
1215 * the numerical comparison operators, this method considers
1216 * negative zero to be strictly smaller than positive zero. If
1217 * one argument is positive zero and the other is negative zero,
1218 * the result is negative zero.
1219 *
1220 * @param a an argument.
1221 * @param b another argument.
1222 * @return the smaller of {@code a} and {@code b.}
1223 */
1224 @HotSpotIntrinsicCandidate
1225 public static float min(float a, float b) {
1226 return Math.min(a, b);
1227 }
1228
1229 /**
1230 * Returns the smaller of two {@code double} values. That
1231 * is, the result is the value closer to negative infinity. If the
1232 * arguments have the same value, the result is that same
1233 * value. If either value is NaN, then the result is NaN. Unlike
1234 * the numerical comparison operators, this method considers
1235 * negative zero to be strictly smaller than positive zero. If one
1236 * argument is positive zero and the other is negative zero, the
1237 * result is negative zero.
1238 *
1239 * @param a an argument.
1240 * @param b another argument.
1241 * @return the smaller of {@code a} and {@code b}.
1242 */
1243 @HotSpotIntrinsicCandidate
1244 public static double min(double a, double b) {
1245 return Math.min(a, b);
1246 }
1247
1248 /**
1249 * Returns the fused multiply add of the three arguments; that is,
1250 * returns the exact product of the first two arguments summed
1251 * with the third argument and then rounded once to the nearest
1252 * {@code double}.
1253 *
1254 * The rounding is done using the {@linkplain
1255 * java.math.RoundingMode#HALF_EVEN round to nearest even
1256 * rounding mode}.
1257 *
1258 * In contrast, if {@code a * b + c} is evaluated as a regular
1259 * floating-point expression, two rounding errors are involved,
1260 * the first for the multiply operation, the second for the
1261 * addition operation.
1262 *
1263 * <p>Special cases:
|