public static double min(RestParam args = default) { var span = args.getSpan(); if (span.Length == 0) { return(Double.PositiveInfinity); } double currentMin = (double)span[0]; if (Double.IsNaN(currentMin)) { return(currentMin); } for (int i = 1; i < span.Length; i++) { double arg = (double)span[i]; if (Double.IsNaN(arg)) { return(arg); } if (arg < currentMin || (currentMin == 0.0 && Double.IsNegative(arg))) { currentMin = arg; } } return(currentMin); }
public static double max(RestParam args = default) { var span = args.getSpan(); if (span.Length == 0) { return(Double.NegativeInfinity); } double currentMax = (double)span[0]; if (Double.IsNaN(currentMax)) { return(currentMax); } for (int i = 1; i < span.Length; i++) { double arg = (double)span[i]; if (Double.IsNaN(arg)) { return(arg); } if (arg > currentMax || (currentMax == 0.0 && !Double.IsNegative(arg))) { currentMax = arg; } } return(currentMax); }