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

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

Re: operation of 'round' function


From: Andreas Schwab
Subject: Re: operation of 'round' function
Date: Thu, 07 Feb 2002 17:40:12 +0100
User-agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux)

Ronan Waide <address@hidden> writes:

|> 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.

Try (round 0.6).

|> The docstring says:
|> 
|> "Return the nearest integer to ARG."
|> 
|> Which should have returned 1, 2, 3, 4, 5 above.

0.5 is exactly halfway between 0 and 1, so the additional rule is that in
case of a tie the even number is used.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 N├╝rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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