Live data from Hacker News

Numbering should start at zero (1982)

cs.utexas.edu

81–90 of 309 posts

Re: Numbering should start at zero (1982)

#81

Numbering should start at π (2025) (umars.edu) Seriously, it all depends on whether u're counting the items themselves (1-based) or the spaces btwn them (0-based). The former uses natural numbers, while the latter uses non-negative integers For instance, when dealing with memory words, do u address the word itself or its starting location (the first byte)? The same consideration applies to coordinate systems: r u pos…

Why do you write “you” as “u” here? I don’t want to be rude, but it’s very jarring to see juvenile txt-speak in a serious discussion.

Re: Numbering should start at zero (1982)

#82
post #71

Earlier quoted context omitted.

I like my numbering to start like my elevator panel: at zero.

American elevators are 1-indexed!

at the whitney art gallery (nyc), the ground floor is 1, but the basement is -1. there's no 0 in between

it bothers me way more than it should. i have to tell myself that the point of art is often to evoke emotions, and the rage i feel is included in that

Re: Numbering should start at zero (1982)

#83

Numbering should start at π (2025) (umars.edu) Seriously, it all depends on whether u're counting the items themselves (1-based) or the spaces btwn them (0-based). The former uses natural numbers, while the latter uses non-negative integers For instance, when dealing with memory words, do u address the word itself or its starting location (the first byte)? The same consideration applies to coordinate systems: r u pos…

That makes sense for the ID system or a database, but for arrays in a language I still prefer starting at 0. It makes frame buffers easier easier to index

Re: Numbering should start at zero (1982)

#84

Perhaps ideally we'd change English to count the "first" entry in a sequence as the "zeroth" item, but the path dependency and the effort required to do that is rather large to say the least. At least we're not stuck with the Roman "inclusive counting" system that included one extra number in ranges* so that e.g. weeks have "8" days and Sunday is two days before Monday since Monday is itself included in the count. *…

It is definitely my engineer myopia, but octaves in music should be called dozens

Re: Numbering should start at zero (1982)

#85
post #71

Earlier quoted context omitted.

American elevators are 1-indexed!

at the whitney art gallery (nyc), the ground floor is 1, but the basement is -1. there's no 0 in between it bothers me way more than it should. i have to tell myself that the point of art is often to evoke emotions, and the rage i feel is included in that

When my badge doesn't scan at work, that is great art

Re: Numbering should start at zero (1982)

#87
post #80

Earlier quoted context omitted.

I don’t know python but I figured out immediately that it should print ['C', 'B']. Does it? If not, Python is just wrong.

No, it doesn't, it prints ['D', 'C']. I agree that it should be ['C', 'B'] - the way that Python handles negative `step` values is wrong.

I don't think it's "wrong" per se - it's zero-based indexing and ranges are consistently inclusive of start, exclusive of end. But, it breaks the "fence-post" mental model that some people use, and is less intuitive than MatLab's indexing approach IMO.

Re: Numbering should start at zero (1982)

#88
>> when starting with subscript 1, the subscript range 1 ≤ i What about the range 0 < i ≤ N which starts with 1? Why only use ≤ on the lower end of the range? This zero-based vs one-based tends to come up in programming and mathematics, and both are used in both areas. Isn't it obvious that there is no universally correct way to index things?

Re: Numbering should start at zero (1982)

#89

Numbering should start at π (2025) (umars.edu) Seriously, it all depends on whether u're counting the items themselves (1-based) or the spaces btwn them (0-based). The former uses natural numbers, while the latter uses non-negative integers For instance, when dealing with memory words, do u address the word itself or its starting location (the first byte)? The same consideration applies to coordinate systems: r u pos…

Why do you write “you” as “u” here? I don’t want to be rude, but it’s very jarring to see juvenile txt-speak in a serious discussion.

it’s not that serious

Re: Numbering should start at zero (1982)

#90

Numbering should start at π (2025) (umars.edu) Seriously, it all depends on whether u're counting the items themselves (1-based) or the spaces btwn them (0-based). The former uses natural numbers, while the latter uses non-negative integers For instance, when dealing with memory words, do u address the word itself or its starting location (the first byte)? The same consideration applies to coordinate systems: r u pos…

> The former uses natural numbers, while the latter uses non-negative integers

In fact “natural numbers” is ambiguous, as it can both contain zero or exclude it depending on who uses it.

See https://en.m.wikipedia.org/wiki/Natural_number

Post reply on HN