Home

Statistics Functions:
The Minimum Value of a Series

 
double __fastcall MinValue(const double * Data, const int Data_Size);

The MinValue() function gets a numeric value that represents the minimum value of the items of an array. This function takes two arguments. The first argument, Data, represents an array of integers or double-precision numbers. The second argument is the number-1 of the items of the array; for example, if the considered array has 4 members, the Data_Size argument would be 3.

To use the MinValue() function, declare an array that involves the necessary numbers. You can initialize such a variable or request the values from the user. To calculate the minimum value of a range, supply the array and its size. If you do not know the dimension of the array, you can use the sizeof operator to find it out. Here is an example that uses the MinValue() function:

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	double Values[] = { 12.55, 10.15, 980.22, 50.50, 280.12 };
	int Size = (sizeof(Values)/sizeof(double)) - 1;

	double Minimum = MinValue(Values,Size);
	Edit1->Text = Minimum;
}
//---------------------------------------------------------------------------
 
Home Copyright © 2004-2016, FunctionX, Inc.