[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: operation of 'round' function
From: |
David Kastrup |
Subject: |
Re: operation of 'round' function |
Date: |
08 Feb 2002 11:35:28 +0100 |
"Eli Zaretskii" <eliz@is.elta.co.il> writes:
> > From: David Kastrup <David.Kastrup@t-online.de>
> > Newsgroups: gnu.emacs.bug
> > Date: 07 Feb 2002 17:13:16 +0100
> >
> > So the doc string should be amended to read
> > "Return the nearest integer to ARG. In case ARG lies equally close to
> > the next and previous integer"
> > and then we'd need the proper statement, something like
> > a) "the behaviour depends on the floating point implementation of the
> > underlying machine Emacs is running on"
> > b) "the next even integer is chosen in compliance with IEEE
> > arithmetic"
> > c) "Emacs consults the variable rounding-direction which
> > can take on the values 't, 'nil or 'randomly meaning..."
>
> Thanks for the suggestions. The correct interpretation is a). I
> fixed the doc string by borrowing what the ELisp reference already
> says:
>
> Rounding a value equidistant between two integers may choose the
> integer closer to zero, or it may prefer an even integer, depending on
> your machine. For example, \(round 2.5\) can return 3 on some
> systems, but 3 on others.
You mean, it can return 3 on some systems and 2 on others. Apart from
which almost *no* machine will choose the integer *closer* to zero
when rounding. Those machines not rounding to even will round *away*
from zero in almost all cases.
> The Emacs primitive simply calls `rint', which works according to the
> current rounding mode.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: David.Kastrup@t-online.de
Re: operation of 'round' function, Andreas Schwab, 2002/02/07