return the min value in the list of double : Array Util « Collections Data Structure « C# / C Sharp






return the min value in the list of double

  

// crudwork
// Copyright 2004 by Steve T. Pham (http://www.crudwork.com)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with This program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace crudwork.Utilities
{
  /// <summary>
  /// Math Utility
  /// </summary>
  public static class MathUtil
  {

    /// <summary>
    /// return the min value in the list of double
    /// </summary>
    /// <param name="values"></param>
    /// <returns></returns>
    public static double Min(params double[] values)
    {
      if (values == null || values.Length == 0)
        throw new ArgumentNullException("values");

      double result = double.MaxValue;

      for (int i = 0; i < values.Length; i++)
      {
        result = Math.Min(result, values[i]);
      }

      return result;
    }
   }
}

   
    
  








Related examples in the same category

1.Return the average of the given values
2.Return the percentage of a given value.
3.return the max value in the list of double
4.Returns a string representation of the sbyte array
5.Returns a string representation of the char array
6.Returns a string representation of the double array
7.Returns a string representation of the float array
8.Returns a string representation of the int array
9.Returns a string representation of the long array
10.Returns a string representation of the object array
11.Returns a string representation of the short value array
12.Returns a string representation of the bool value array
13.Ensures that the sbyte array cannot hold more than maxCapacity elements.
14.Ensures that the char array cannot hold more than maxCapacity elements.
15.Ensures that the double array cannot hold more than maxCapacity elements.
16.Ensures that the float array cannot hold more than maxCapacity elements.
17.Ensures that the int array cannot hold more than maxCapacity elements.
18.Ensures that the long array cannot hold more than maxCapacity elements.
19.Ensures that the object array cannot hold more than maxCapacity elements.
20.Ensures that the short array cannot hold more than maxCapacity elements.
21.Ensures that the bool array cannot hold more than maxCapacity elements.
22.Copy an array into another array.
23.Swap two elements in a array
24.Generic Growable Array
25.foreach is used to display the contents of an array of integers.
26.Are two arrays equal.
27.Are thos two arrays having the save contents
28.Convert object array to string
29.Get array size
30.Convert array content to generic type array
31.Searches for the specified object and returns the index of the first occurrence within the entire one-dimensional System.Array.
32.Creates a new array with just the specified elements.
33.Array 2D
34.Get a array of object from a enum datatype.
35.Reinitializes an int array to the given value in an optimized way: intArraySet
36.Returns a Boolean indicating whether the Array is Empty (is Null or has a length of zero).
37.Places elements from an enumerable into an array.
38.Bit Array 2D
39.Counting the distribution of the values in an array.
40.Collection of static methods for operations on arrays
41.Char Array Writer
42.Computes the indices
43.Compare Array
44.Remove element from Array
45.Concatenate Array
46.Get the array slice between the two indexes
47.Find subarray in the source array.
48.Check if the array contains needle on specified position