Question

How to set in control word of FPU bits in RC to 3?


answer (editor's note: don't post answers as part of the question, but for now it's here)

fstcw word ptr cw
or word ptr cw, 110000000000b
fldcw word ptr cw
Was it helpful?

Solution

Looking at the fasm manual, you'd need to use fstcw to store the control word in a 16 bit memory location, modify the appropriate bits, and then use fldcw to load the modified control word.

The appropriate bits in this case are bits 10 and 11, and you want to set them both to 1, so or the memory location with 0x0C00 (3 << 10).

This will set the FPU to truncate all rounding and conversions, which hopefully is what you're trying to achieve.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top