x86 floating point modulus

Started by
1 comment, last by PeterTarkus 19 years, 11 months ago
What is the general algorithm to calculate a floating point modulus on the FPU? I tried this loop: fprem1(); test(c2) --> blah blah, more involed, pseudo code :-) jnz loop; fstp(st0); --> crash, did fprem1() knock it off?? but for whatever reason when I try to pop off the stack it crashes, could be a bug in my assembler or it could be I am not doing something right. Any easier way to do it? Peace
Advertisement
fmod
Never mind, I got it to work. And no, fmod was not a solution. I am writing a compiler backend for a JIT. A call to fmod would run cloase to 100 microseconds, which seems small, but in comparison I fixed the loop now that it runs in about 2 microseconds.


This topic is closed to new replies.

Advertisement