[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 <ronan.waide@euroconex.com> 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, schwab@suse.de
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."
Re: operation of 'round' function,
Andreas Schwab <=
Re: operation of 'round' function, David Kastrup, 2002/02/07
Re: operation of 'round' function, Al Petrofsky, 2002/02/07
Message not available