The
IEEE 754 standard deals with the representation of
floating point numbers in
computers. It also suggests four different
rounding modes. They differ in accuracy and speed. Rounding is generally done after an floating point operation like
addition or
multiplication. The result of such an operation has two additional
LSBs: the
guard bit and the round bit. They help to maintain accurate intermediate results.
The easiest and quickest way to round is called rounding down, the last bits are just truncated. Obviously this is pretty inaccurate (011 would become 000 instead of the more exact 100).
The second way to round is called rounding up, this is nearly the opposite of rounding down, as every time the last bits are truncated and 1 is added to the last position. But this operation has a special case: if 0..0 is truncated 1 is not added. Having a special case and using an add this operation is slower, but a bit more accurate.
The third way is called rounding off. It is pretty accurate, as the last bits are truncated, but 1 is only add if the highest truncated bit was equal to 1.
The most accurate way to round by IEEE 754 is called round to nearest even. The last bits are truncated. 1 is added if either the truncated bits
were > 10...0 or the truncated bits were = 10...0 and the last maintained bit is equal to 1.
The last mode is standard as it is the most accurate. Accuracy is more important than speed, as floating point is often used in science and nothing is worse in science than a wrong result.
Sources:
Computer Organization & Design: The Hardware / Software Interface, David A. Patterson and John L. Hennessy, Morgan Kaufmann Publishers, San Francisco, California
Technische Grundlagen der Informatik II: Script, Prof. Dr. Michael Gössel, University of Potsdam
Spim Tutorial: Einführung in die Assemblerprogrammierung mit MIPS, Reinhard Nitzsche, available online
Grundlagen der Digitaltechnik, Prof. Dr.-Ing. Dr.-Ing h.c. Dr. h.c. Hans Martin Lipp, Oldenbourg Verlag, München and Wien
Technische Informatik I, Wolfram Schiffmann and Peter Schmitz, Springer Lehrbuch, Berlin
Spim Documentation, available at http://www.cs.wisc.edu/~larus/spim.html