C++ cmath fmin() function
Example
Return the lowest value from different pairs of numbers:
cout << fmin(2.0, 0.25);
cout << fmin(31.2f, 18.0f);
cout << fmin(14, 22);
cout << fmin(96, 2048);
Try it Yourself »
Definition and Usage
The fmin()
function returns the number with the lowest value from a pair of numbers.
The fmin()
function is defined in the <cmath>
header file.
Tip: Use the fmax() function to return the number with the highest value.
Syntax
One of the following:
fmin(double x, double y);
fmin(float x, float y);
Parameter Values
Parameter | Description |
---|---|
x |
Required. Specifies a value to be compared. If this is an integer type then it will be treated as a double .
|
y |
Required. Specified a value to be compared. If this is an integer type then it will be treated as a double .
|
Technical Details
Returns: | A float value (if all the arguments are float) or double value (in any other case) representing the lowest of two numbers. |
---|