min
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
√ |
|
x |
|
x |
Function
Compares two numbers of the same data type and returns the minimum value.
Prototype
1 2 | template <typename T, typename U> __aicore__ inline T min(const T src0, const U src1) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of the input data src0. Currently, the following data types are supported: bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, int64_t, uint64_t. |
U |
Data type of the input data src1. Currently, the following data types are supported: bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, int64_t, uint64_t. Reserved type. Currently, the value must be the same as that of T. |
Parameter |
Input/Output |
Description |
|---|---|---|
src0 |
Input |
Source operand. This is the input for comparison. |
src1 |
Input |
Source operand. This is the input for comparison. |
Restrictions
The data types of the two source operands must be the same.
Returns
Minimum value of the two input data elements.
Example
1 2 3 4 5 | int64_t src0 = 1; int64_t src1 = 2; int64_t result = AscendC::Std::min(src0, src1); // result: 1 |