Quick math notation question

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. =)

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.

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

It’s called interval notation. I don’t know what’s up with that 0.4 problem, though. I suspect this has something to do with modular arithmetic, but I’m not sure.

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!

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!