# Quick math notation question

**URL:** <https://boards.straightdope.com/t/quick-math-notation-question/234978>\
**Category:** Factual Questions\
**Created:** [March 18, 2004, 4:16am UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978 "2004-03-18T04:16:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parallax](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@Parallax](https://boards.straightdope.com/u/Parallax)\
**Post date:** [March 18, 2004, 4:16am UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978/1 "2004-03-18T04:16:17Z")

</div>

I’m working on some code to compute sunrise and sunset times and the web page I’m using as a reference has a range notation that I don’t fully understand.

Here is an example:

NOTE: UT potentially needs to be adjusted into the range [0,24) by adding/subtracting 24

I had been assuming that it simply meant that if the values was less then 0 I should add 24 and if it was greater than 24 I should subtract 24 - but while testing I ran into a case where UT was 0.4 and I only got the correct answer if I added 24 to UT.

So my thinking now is that the [ and ) notation is special - where I’m supposed to round or do something strange with the fractional part. It doesn’t make a whole lot of sense to me but everything else seems fine so I’m at a loss to explain it.

I figure unless whoever wrote the page mistyped every time they wanted to enter (0,24) or [0,24] it must mean something that I’m not catching.

I tried a Google search but it is a tough thing to seach for. =)

---

<div class="post-metadata">

**Author:** ![ftg](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ftg/32/2801_2.png) [@ftg](https://boards.straightdope.com/u/ftg)\
**Post date:** [March 18, 2004, 4:31am UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978/2 "2004-03-18T04:31:08Z")

</div>

When giving a range, brackets mean “including” while parens mean “not including”. So [0,24) means the range including 0 up to, but not including, 24.

---

<div class="post-metadata">

**Author:** ![Mathochist](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mathochist](https://boards.straightdope.com/u/Mathochist)\
**Post date:** [March 18, 2004, 5:37am UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978/3 "2004-03-18T05:37:08Z")

</div>

> [@Parallax](#):
>
> I had been assuming that it simply meant that if the values was less then 0 I should add 24 and if it was greater than 24 I should subtract 24 - but while testing I ran into a case where UT was 0.4 and I only got the correct answer if I added 24 to UT.

Do you want it to come out to “24.4”? In that case, replace the interval with [1,25)

---

<div class="post-metadata">

**Author:** ![TJdude825](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@TJdude825](https://boards.straightdope.com/u/TJdude825)\
**Post date:** [March 18, 2004, 8:02am UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978/4 "2004-03-18T08:02:12Z")

</div>

It’s called [interval notation](http://id.mind.net/~zona/mmts/miscellaneousMath/intervalNotation/intervalNotation.html). I don’t know what’s up with that 0.4 problem, though. I suspect this has something to do with [modular arithmetic](http://en.wikipedia.org/wiki/Modular_arithmetic), but I’m not sure.

---

<div class="post-metadata">

**Author:** ![Parallax](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@Parallax](https://boards.straightdope.com/u/Parallax)\
**Post date:** [March 18, 2004, 2:47pm UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978/5 "2004-03-18T14:47:42Z")

</div>

Hrm - I figured it was an inclusive/exclusive thing but that doesn’t cover this 0.4 case. I’ll take a look at the code to see if I made a mistake and/or should be handling this a different way. Thanks!

---

<div class="post-metadata">

**Author:** ![spingears](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@spingears](https://boards.straightdope.com/u/spingears)\
**Post date:** [December 20, 2004, 1:23am UTC](https://boards.straightdope.com/t/quick-math-notation-question/234978/6 "2004-12-20T01:23:52Z")

</div>

> [@Parallax](#):
>
> I’m working on some code to compute sunrise and sunset times and the web page I’m using as a reference has a range notation that I don’t fully understand.

You can find sunrise sunset times calculated/tabulated for the eentire year at the Naval Observatory and othe sites. For local times compensate for lat./long. per instructions.

_"Never do something simply when a way can be found to make it complex and wonderful!_
