I'm having a difficult time understanding IEEE 754 Rounding conventions:
If I have a binary number composed of 9 bits to the right of a binary point and I need to use the 3 right most bits to determine rounding what would I do?
This is homework so that's why I'm being vague about the question...I need help with the concept.
Thank you!
Round towards positive infinity means the result of the rounding is never smaller than the argument.
Round towards negative infinity means the result of the rounding is never larger than the argument.
Round to nearest, ties to even means the result of rounding is sometimes larger, sometimes smaller than (and sometimes equal to) the argument.
Rounding the value +0.100101110
to six places after the binary point would result in
+0.100110 // for round towards positive infinity
+0.100101 // for round towards negative infinity
+0.100110 // for round to nearest, ties to even
The value is split
+0.100101 110
into the bits to be kept and the bits determining the result of the rounding.
Since the value is positive and the determining bits are not all 0, rounding towards positive infinity means incrementing the kept part by 1 ULP.
Since the value is positive, rounding towards negative infinity simply discards the last bits.
Since the first cut off bit is 1 and not all further bits are 0, the value +0.100110
is closer to the original than +0.100101
, so the result is +0.100110
.
More instructive for the nearest/even case would be an example or two where we actually have a tie, e.g. round +0.1001
to three bits after the binary point:
+0.100 1 // halfway between +0.100 and +0.101
here, the rule says to pick the one with last bit 0 (last bit even) of the two closest values, i.e. +0.100
and this value is rounded towards negative infinity. But rounding +0.1011
would round towards positive infinity, because this time the larger of the two closest values has last bit 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With