i've got some problem to find a complete floating instruction documentation.

Now i need to compare to float real8 values.
I've found FCOM but i couldn't find an explaination of this instruction.

How can i compare st(0) with st(1) ?
Is FCOM the right instruction ?
What's the correct syntax ?

thanks angelo
Posted on 2001-07-20 08:17:42 by Bit7
``````
Instruction      Description
FCOM m32real     Compare ST(0) with m32real.
FCOM m64real     Compare ST(0) with m64real.
FCOM ST(i)       Compare ST(0) with ST(i).
FCOM             Compare ST(0) with ST(1).
FCOMP m32real    Compare ST(0) with m32real and pop register stack.
FCOMP m64real    Compare ST(0) with m64real and pop register stack.
FCOMP ST(i)      Compare ST(0) with ST(i) and pop register stack.
FCOMP            Compare ST(0) with ST(1) and pop register stack.
FCOMPP           Compare ST(0) with ST(1) and pop register stack twice.
``````
Posted on 2001-07-20 08:28:44 by gamital
thanks
Posted on 2001-07-20 11:34:32 by Bit7
don't forget that after any compare you have to use the following two instructions:

fstsw ax
sahf

Then you can use conditional jumps, etc
Posted on 2001-07-20 17:20:47 by Eóin
I think scali whipped up some macros for floating-point conditional
jumps. Check out http://sourcevault.cjb.net .
Posted on 2001-07-21 03:40:23 by f0dder
Keep in mind that if you want to compare 2 REAL4 value, you can use the normal cmp instruction (a real4 value can fit in DWORD). It easier and faster.

Note : you can even compare a REAL4 value with a DWORD Integer.

(s)
Posted on 2001-07-22 04:29:59 by (scalp)
Are you sure scalp. I mean the binary representation of 1 and 1.0f are completly different. If you used cmp they wouldn't register as equal.

In fact the only crossover between the integer and floating point binary representations of numbers is for zero. In fact this won't even always be the case as there are two valid representations of zero in floating point fromat. +0 and -0
Posted on 2001-07-22 05:21:23 by Eóin
U're right Zadkiel, u can compare 2 float each other using cmp, and cmp a float with 0 but not a float with int.
I don't know why i thought that....

(s)
Posted on 2001-07-22 05:37:16 by (scalp)
You can't even compare to float's for equality this way. Because of
rounding errors (etc), you should always allow for a very little difference
between to floats, even if testing for equality.
Posted on 2001-07-22 10:28:57 by f0dder