News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

float compare xmm

Started by dusty, February 10, 2013, 12:06:13 PM

Previous topic - Next topic

dusty

How can I compare two floats, xmm0 and xmm1 without using fpu and return answer i rax
int compf( double x, double y) "c++ calling function.  x64
x < y,  x > y ??

qWord

use COMISS for REAL4 (=float) or COMISD for REAL8 (=double). These instruction sets the eFlags:
xor eax,eax ; clear rax
movss xmm0,value1
movss xmm1,value2
comiss xmm0,xmm1
ja @foo  ; jump if value1 > value2
jb @foo  ; jump if value1 < value2
je ...
jae ...

seta al ; set AL if value1 > value2
...
MREAL macros - when you need floating point arithmetic while assembling!

dusty

qword;
thanks that did the trick
your'e to goodest  :dazzled: