Minimum and Maximum Functions
The FPU module supports all minimum and maximum operations defined in the IEEE 754-2019 standard. The IEEE 754-2008 minNum(x,y) and maxNum(x,y) operations are not directly supported.
- FMINNUM, FMAXNUM: IEEE 754-2019 minimumNumber(x,y)/maximumNumber(x,y) functions. When one of the input operands is a NaN and the other input is a floating-point number (that is not a NaN), the instructions will return the floating-point number. If both input operands are a NaN, the instructions will return a qNaN.
- FMIN, FMAX: IEEE 754-2019 minimum(x,y)/maximum(x,y) functions. When one (or both) of the input operands is a NaN, the instructions will return a qNaN.
Refer to the truth table shown in Table 6-36 for a definition of how NaN operands are handled.
For all minimum and maximum operations, any finite operand value will compare as less than +infinity, or greater than -infinity. Operand value of -0 compares to less than +0.
Op | Source Operands | Invalid Exception Mask | Result Fd | FSR.INVAL | Invalid Exception Taken? | |
---|---|---|---|---|---|---|
Fb | Fs | |||||
FMINNUM FMAXNUM FMIN FMAX | FPN1 | FPN2 | Don’t care | FPN1 or FPN2(1,2,3,4) | 0 | No |
qNaN1 | qNaN2 | Don’t care | qNaN1 or qNaN2 (5) | 0 | No | |
sNaN | qNaN | 1 | qNaN (Fs) (6) | 1 | No | |
0 | Yes | |||||
qNaN | sNaN | 1 | qNaN (Fb) (6) | 1 | No | |
0 | Yes | |||||
sNaN1 | sNaN2 | 1 | Quieted sNaN1 or sNaN2 (5) | 1 | No | |
0 | Yes | |||||
FMINNUM FMAXNUM | FPN1 | qNaN | Don’t care | FPN1 | 0 | No |
qNaN | FPN2 | Don’t care | FPN2 | 0 | No | |
FPN1 | sNaN | 1 | FPN1 | 1 | No | |
0 | Yes | |||||
sNaN | FPN2 | 1 | FPN2 | 1 | No | |
0 | Yes | |||||
FMIN FMAX | FPN1 | qNaN | Don’t care | qNaN (Fs) | 0 | No |
qNaN | FPN2 | Don’t care | qNaN (Fb) | 0 | No | |
FPN1 | sNaN | 1 | Quieted sNaN (Fs) | 1 | No | |
0 | Yes | |||||
sNaN | FPN2 | 1 | Quieted sNaN (Fb) | 1 | No | |
0 | Yes |
Note:
- FPN1 and FPN2 are floating-point numbers that are not a NaN (i.e., normal, zero, infinity or sub-normal).
- Result determined by FMINNUM/FMIN or FMAXNUM/FMAX operation.
- Operand value of -0 compares to less than +0.
- If Fb = Fs (and of the same sign, including infinities), result (Fd) will be loaded with Fb.
- NaN with largest significand will be passed to result (Fd), quieted if an sNaN.
- qNaN values have priority over sNaN values (see Table 6-38).