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

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

```
```

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.

thanks

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

fstsw ax

sahf

Then you can use conditional jumps, etc

I think scali whipped up some macros for floating-point conditional

jumps. Check out http://sourcevault.cjb.net .

jumps. Check out http://sourcevault.cjb.net .

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)

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

(s)

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

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

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)

I don't know why i thought that....

(s)

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.

rounding errors (etc), you should always allow for a very little difference

between to floats, even if testing for equality.