1

Google isn't being helpful for me today, and the StackOverflow search is returning no results. However, this could be the result of inefficient keyword usage.

My question is: when speaking of a range of numbers in a programming language, what do the symbols "(", ")", "[", and "]" mean?

For example, (0, 10], or [0, 10).

See this question, where the referenced symbols are used both in the title and question text.

My theory is that "(" and ")" mean "excluding" and "[" and "]" mean "including". Is this a correct hypothesis?

Community
  • 1
  • 1
hmc_jake
  • 372
  • 1
  • 17
  • 4
    This has nothing to do with Java (or its use of such symbols) - see https://en.wikipedia.org/wiki/Interval_(mathematics) – user2864740 Aug 02 '15 at 06:03
  • 5
    I'm voting to close this question as off-topic – Lior Kogan Aug 02 '15 at 12:35
  • @LiorKogan May I know why, exactly? – hmc_jake Aug 02 '15 at 17:02
  • Can I know why this was downvoted? ("Not useful, shows no effort, badly formatted, etc"?) – hmc_jake Aug 02 '15 at 17:12
  • @hmc_jake: It got nothing to do with programming. http://math.stackexchange.com/ is much more suitable. – Lior Kogan Aug 02 '15 at 17:44
  • @LiorKogan When I asked the question, I did not know that it was not programming-specific and that it was, in-fact, mathematics-specific. I thought this was programming lingo, so that's why I asked here. I think a move vote (if those exist) would be better than a close vote. And I especially don't believe I deserve to have my reputation damaged over this with downvote(s). – hmc_jake Aug 02 '15 at 17:46
  • @hmc_jake: I agree, it doesn't deserve downvotes, But don't take it so hard. The important thing is that you now know the answer ;-) – Lior Kogan Aug 02 '15 at 17:50
  • @LiorKogan Would it be better to just delete this myself, then? – hmc_jake Aug 02 '15 at 17:51
  • @hmc_jake: I think you can't delete it if it has an upvoted answer. see http://meta.stackexchange.com/questions/5221 – Lior Kogan Aug 02 '15 at 18:05
  • I'm voting to close this question as off-topic because it is about mathematical notations, not programming. – Pang Aug 08 '15 at 02:17
  • why doesn't your math text book teach about this? – phuclv Jan 13 '16 at 07:29

1 Answers1

3

After viewing the article (provided by a commenter) on Intervals (a mathematical concept), I was able to determine the answer. (See the article here.)

As defined by the article, an open interval (uses "(" and ")") means that the interval does not include its endpoints (i.e. excluding a number.) A closed interval (uses "[" and "]") means that the interval does include its endpoints (i.e. including a number.)

With these defined, then with the examples included in the question:

  • (0, 10] means greater than (and not including) zero and including ten.
  • [0, 10) means greater than (and including) zero and less than ten.
hmc_jake
  • 372
  • 1
  • 17
  • 2
    "greater than (and not including)" = "greater than"; "greater than (and including)" = "greater than or equal to" – user2864740 Aug 02 '15 at 06:17
  • It's not clear from context whether you're talking about intervals on the real line, or whether your domain is restricted to integers. The interval `(0, 10]` contains `0.5`, which is not greater than (or greater than or equal to) `1`. "(Strictly) greater than zero" would be a better description of that endpoint. As @user2864740 already noted, the "strictly" here is unnecessary (though perhaps helpful for emphasis). – Mark Dickinson Aug 02 '15 at 17:02
  • @MarkDickinson Thank you. I updated the answer. – hmc_jake Aug 02 '15 at 17:08