PDA

Click to See Complete Forum and Search --> : Comparing Floating Points


Sam Finch
Nov 2nd, 2000, 06:14 PM
Say I want to compare 2 floaring point numbers, I have a number in st(7) and a number in st(0), I want to compate st(7)with st(0) and pop st(0), then jump if st(0) was greater than st(7).

So I should use fcomp, I've got that much, but then what, do I just use ja or is there a special thing I have to do?

parksie
Nov 3rd, 2000, 03:49 PM
I think it sets the comparison flag in the same way as cmp, so the normal jump commands can be used.

Sam Finch
Nov 4th, 2000, 06:28 AM
again you're too late parksie, you're wrong as well.

fcomp sets the FPU status word, which you can copy to ax using fstsw, then you have to use test or bt or something to check the relevent bits.

parksie
Nov 4th, 2000, 10:40 AM
Ooops...

Oh well - it's what I managed to extract from the rather minimal docs I have...anyway, you've got it sorted now, so that's okay.

(notes down info for future reference) <-- see? learn something new every day :)

Sam Finch
Nov 4th, 2000, 01:25 PM
The Art Of Assembler has some pretty good info on it, so does intel, there's links to AoA all over this site so I won't bother looking it up. just in case you need to do some floating point stuff

parksie
Nov 4th, 2000, 01:32 PM
I found a really neat trick for learning how to do certain things with asm...

Write it in C++, then turn full listings on in the project options. Out comes a load of asm code :).

Sam Finch
Nov 4th, 2000, 02:13 PM
I can't find that, I use the dissasembly window when it's debugging (run it and put a break point in, then right click on the code you want and hit go to dissasembly, and there's all your code.