There are several rounding modes in the IEEE 754 floating point standard, my question is: is the rounding mode selected based on the guard/round/sticky bits or does a programmer specify what mode to use?
1
votes
This question is a little broad. Do you have a specific application in mind?
- Eric Hauenstein
I'm making a floating point adder in Logisim (a logic simulator) and after the addition I have to round the result, for example rounding up. What i don't understand is whether this rounding mode is chosen based on the result of the addition or a programmer tells it to round up, down, etc...
- Marjolein Breysens
1 Answers
2
votes
The rounding mode is chosen by the programmer. Either the rounding mode is stored in a “control register” inside the FPU, and is changed through a specific (expensive) instruction, or each floating-point instruction has a few bits reserved to indicate what rounding mode it is intended to be executed in.
Either way, the programmer controls the rounding mode that applies each time a floating-point instruction is executed, and the rounding mode influences how the guard/round/sticky bits are interpreted to round the result, not the other way round.