| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Rounding |
From: Ellen K. Some of my cousins were in town yesterday and we had dinner. On learning I program in VB, one of them asked "16-bit or 32-bit"? I almost fell off my chair. She apologized by saying the way I'd been describing Kaiser, she wouldn't have been surprised to learn I was doing 16-bit there. I didn't realize integer division was also affected in the way you describe. What about Mod? The biggest thing that surprised me in VB after learning C/C++ was arguments being passed by reference as the default. VB7 (the .Net version) has changed that, now ByVal is the default. On Wed, 13 Nov 2002 11:35:51 GMT, John Beckett wrote in message : >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™.