Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

1.1k questions

1.2k answers

1.6k comments

529 users

0 votes
I always don't understand how I can round a resyfloat number (IEEE 754). I use the tools, but sometimes nothing changes when you round with Nearest to Even, sometimes +1 is added to the mantissa ... At the moment, the number in ResyfloatZahl is very easy for me to represent, but I don't know exactly which method you use to round this previous formula. Especially * to nearest even * to nearest zero * to nearest -∞ / + ∞. Does the rounding only depend on the mantissa? or do you convert the whole ResyZahl into decimal first? I would be very happy if someone can explain to me an exact procedure how I can do it after I have shown my resyfloat number. Some fellow students said that maybe you should do this rounding before displaying the resyfloat number, but we don't know.
in TUK (TU Kaiserslautern) by (180 points)
For example (WS17) Exercise 3, where the rounding of the Resy number 2.72 to nearest to even has not changed anything. And at -2.9 it is rounded differently.

1 Answer

0 votes
 
Best answer
In general, rounding has the task to map a given number which cannot be exactly represented to the closest representable number. In that sense, rounding is uniquely defined this way, except for the nasty case where a given number x lies exactly between two representable numbers x0 and x1. For instance, if we would have no digits after the decimal point, the number 3.5 would have to be rounded to either 3.0 or 4.0.

Only in that case, the different rounding modes make a difference. We may now decide to always round to +oo, to -oo, or whatever the rounding modes determine as one of the two numbers x0 and x1. Round to nearest even will pick the one of x0 or x1 that has an even mantissa. In the above case, it would be 4.0 which is the even number of the two (note that one is always even and the other one is odd).
by (166k points)
selected by
thx. For example the number 2.72 decimal in ResyZahl is [01001011] = 2.75 but in tools the rounding to nearest to even is also the same, although the mantissa is not even and the number is closer to 3.
Also to round -2.9 in Resyfloat number to nearest even. here one has added +1 to the mantissa afterwards
Right, when I wrote above that we round to the nearest even integer, I mean the mantissa that is then interpreted as an integer number (ignoring the decimal point).

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Imprint | Privacy Policy
...