bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

operation of 'round' function


From: Ronan Waide
Subject: operation of 'round' function
Date: Thu, 7 Feb 2002 15:23:29 +0000

This may be a bug, or may simply be a failure of understanding on my
part. However.

GNU Emacs 20.7.1 (i386-redhat-linux-gnu, X toolkit) of Mon Jul 30 2001
on stripples.devel.redhat.com

(round 0.5) = 0
(round 1.5) = 2
(round 2.5) = 2
(round 3.5) = 4
(round 4.5) = 4

and so forth. It appears to be rounding to the nearest /even/
integer. The docstring says:

"Return the nearest integer to ARG."

Which should have returned 1, 2, 3, 4, 5 above.

Cheers,
Waider.
-- 
Ronan Waide / Solaris Wrangler / euroConex Technologies Ltd.


From "-user news"@nextra.no Thu Feb 07 10:52:38 2002
Received: from mailbox1.ucsd.edu ([132.239.1.53])
        by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian))
        id 16Yqqj-0006kT-00
        for <address@hidden>; Thu, 07 Feb 2002 10:52:37 -0500
Received: from smarthost1.nsc.no (smarthost1.e.nsc.no [193.213.112.62])
        by mailbox1.ucsd.edu (8.12.1/8.12.1) with ESMTP id g17FqYnw004358
        for <address@hidden>; Thu, 7 Feb 2002 07:52:35 -0800 (PST)
Received: from news2.ulv.nextra.no (news2.ulv.nextra.no [10.122.112.19])
        by smarthost1.nsc.no (Postfix) with QMQP id 74B7E71D3F
        for <address@hidden>; Thu,  7 Feb 2002 16:52:33 +0100 (MET)
To: address@hidden
Path: 53ab2750!not-for-mail
Newsgroups: gnu.emacs.bug
Subject: Re: operation of 'round' function
References: <address@hidden>
Organization: Private
From: address@hidden (Peter J. Acklam)
Message-ID: <address@hidden>
Lines: 20
User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1
 (i386-msvc-nt4.0.1381)
Cancel-Lock: sha1:JlmHY7QX6W5E+QGfbfSTyrbA9is=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: 62.92.57.66
X-Complaints-To: address@hidden
NNTP-Posting-Date: Thu, 07 Feb 2002 16:52:33 MET
X-Trace: news2.ulv.nextra.no 1013097153 62.92.57.66
Date: Thu, 07 Feb 2002 15:52:33 GMT
Sender: address@hidden
Errors-To: address@hidden
X-BeenThere: address@hidden
X-Mailman-Version: 2.0.5
Precedence: bulk
List-Help: <mailto:address@hidden>
List-Post: <mailto:address@hidden>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs>,
        <mailto:address@hidden>
List-Id: Bug reports for GNU Emacs,
        the Swiss army knife of text editors <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs>,
        <mailto:address@hidden>
List-Archive: <http://mail.gnu.org/pipermail/bug-gnu-emacs/>

address@hidden (Ronan Waide) wrote:

> It appears to be rounding to the nearest /even/ integer.
> The docstring says:
>
> "Return the nearest integer to ARG."
>
> Which should have returned 1, 2, 3, 4, 5 above.

Your interpretation of the docstring is incorrect.  The docstring
actually says nothing about what should happen in the cases when
the fractional part is exactly 0.5.  The reason is of course that
in such cases the term "nearest" is ambiguous.  Both 2 and 3 are
equally near (and far) from 2.5.

Peter

-- 
I put the batteries the wrong way in my flashlight.
Now when I turn it on, it gets dark.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]