Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!drn.maxwell.syr.edu!news.maxwell.syr.edu!meganewsservers.com!feeder2.on.meganewsservers.com!feed.cgocable.net!news2.epix.net!news1.epix.net!not-for-mail
Reply-To: "Timothy J. Bruce" <uniblab@hotmail.com>
From: "Timothy J. Bruce" <uniblab@hotmail.com>
Newsgroups: comp.databases.theory,medicine.brain.tumors.humor
References: <1102561639.956419.146550@z14g2000cwz.googlegroups.com>
Subject: Re: Why do programmers start counting from 0?
Lines: 50
Organization: PeopleSuck Industries
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <dSLud.925$925.97879@news1.epix.net>
Date: Sun, 12 Dec 2004 00:00:09 GMT
NNTP-Posting-Host: 216.222.245.153
X-Complaints-To: abuse@epix.net
X-Trace: news1.epix.net 1102809609 216.222.245.153 (Sat, 11 Dec 2004 19:00:09 EST)
NNTP-Posting-Date: Sat, 11 Dec 2004 19:00:09 EST
Xref: dp-news.maxwell.syr.edu comp.databases.theory:28991


<timothychung@gmail.com> reported confusion
> One day, I started wondering why we start counting from 0
Here is the answer why PROGRAMMERS start counting at zero:
<snip>
U1R2  EQU 0xF2
U2R1  EQU 0xE1
U2L1  EQU 0xDF
U1L2  EQU 0xEE
D1L2  EQU 0x0E
D2L1  EQU 0x1F
D2R1  EQU 0x21
D1R2  EQU 0x12
MoveRose: DB U1R2, U2R1, U2L1, U1L2, D1L2, D2L1, D2R1, D1R2
MoveRoseCount: EQU 0x08
...
MOV SI, MoveRose
MOV AX, SI
; AX now points to the first element of the MoveRose array,
; AX = SI + 0
INC AX
; AX now points to the second element of the array,
; AX = SI + 1
INC AX
; AX now points to the third element of the array,
; AX = SI + 2
MOV SI, AX
MOV DL, [SI]
; DL now holds the value 0xDF because that is the third element of the
MoveRose array,
; [MoveRose + 2]
</snip>

Mathematicians start counting at zero because is typically the root of the
integer domain...
Z = {0, -1, 1, -2, 2, -3, 3, ... , -n, n, ... }
...and often included in the positive integer domain...
Z+ = {0, 1, 2, 3, ... }

Normal people start counting at one because they were told Counting Numbers
(those you can count on your fingers) don't include zero, and start with
one, and end with ten, and learn it as an ordered-list...
C = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

HTH,
Timothy J. Bruce
uniblab@hotmail.com
</RANT>


