Comparing Floating Point Numbers

Name:

FCMP $X,$Y,$Z
FEQL $X,$Y,$Z
FUN $X,$Y,$Z
FCMPE $X,$Y,$Z
FEQLE $X,$Y,$Z
FUNE $X,$Y,$Z

Specification:
FCMP:
s($X) ← { - 1 if f($Y) < f($Z)
0 if f($Y) = f($Z)
+1 if f($Y) > f($Z)
FEQL:
s($X) ← { 1 if f ($Y) = f($Z)
0 otherwise

Let Nε(u) = {x| |x - u|≤ ε 2e-q}, where q is the excess and e = E + q is the sum of exponent and excess of the floating point representation of u. Then:
FCMPE:
s($X) ← { - 1 if f($Y) < Nε(f($Z)) and Nε(f($Y)) < f($Z)
0 if f($Y) ∈ Nε(f($Z)) or f($Z) ∈ Nε(f ($Y))
+1 if f($Y) > Nε(f($Z)) and Nε(f($Y)) > f($Z)
FEQLE:
s($X) ← { 1 if f($Y) ∈ Nε(f($Z)) and f($Z) ∈ Nε(f ($Y))
0 otherwise

The value of ε is taken from the special register rE.

FUN:
s($X) ← { 1 if either $Y or $Z is not a Number (NaN),
0 otherwise
FUNE:
s($X) ← { 1 if either $Y, $Z or rE is not a Number (NaN),
0 otherwise

Description:

For a more detailed description see for example [mmix-doc].