Archived

This topic is now archived and is closed to further replies.

x86 floating point modulus

This topic is 4963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.


Share this post


Link to post
Share on other sites