> p. 83 'Coercions and Component Extraction'
> I find it quite odd that round 3.5 returns 4, but round 2.5 returns 2.
> I always thought that round x.5 returns x+1 (instead of the
> even integer).
>> That's the behaviour in most math books and programming languages

Thinking of it, "round" should probably be viewed as a method to convert a
float to another float of less precision (and not a conversion to an
integer). Then there is the traditional method to round up if the first
digit discarded is five or higher. The IEEE evidently has another method
(rounding to even).

In addition there are various methods for extracting the nearest integer of
a float (or, in math, a real). For example, truncation, discarding the
fractional part, and finding the integer part, represented in C/C++ by the
functions floor() and ceil().

These methods are used for other purposes than the rounding method.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>




Reply via email to