TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Ellen K.
from: John Beckett
date: 2002-11-13 11:35:50
subject: Re: Rounding

From: John Beckett 

Ellen K.  wrote in message
news::
> The weird rounding was in VB 5 already, and maybe earlier versions,

Yes! I keep VB3 for nostalgic reasons. VB people used to have mega
arguments about the fact that VB3 has the "fair" rounding
discussed in this thread.

Here is a command (first line) and the response (second line) in the
immediate command window of VB3:

? CInt(1.5); CInt(2.5)
 2  2

Here, "?" means "print the value of". CInt is
"convert to integer". This shows that 1.5 is rounded up, while
2.5 is rounded down.

VB has many mind-boggling features. Integer division (\) is one:

? 1.5 \ 1; 2.5 \ 1
 2  2

Here we see that integer division cleverly rounds the values BEFORE the
division. A humble C programmer finds this behaviour quite unfair.

John

--- BBBS/NT v4.01 Flag-4
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/1.45)
SEEN-BY: 3/2 10 106/1 120/544 123/500 379/1 633/260 267 270 285 774/0 605
SEEN-BY: 2432/200
@PATH: 379/1 106/1 123/500 774/605 633/260 285

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.