min
uint8_t min(uint8_t a, uint8_t b)int8 min(int8 a, int8 b)
int min(int a, int b)
float min(float a, float b)
Description
Returns the smaller of two numeric values.
Both arguments may be of different numeric types; in that case the result type is promoted to the higher-precision type (float > int > int8 > uint8_t).
Parameter
- a - The first numeric value.
- b - The second numeric value.
Returns
The minimum of a and b. The return type is the dominant type of both arguments.
Example
void main()
{
int a = min(3, 7); // a = 3
float b = min(1.5, 2.5); // b = 1.5
float c = min(2, 1.5); // c = 1.5 (int promoted to float)
}