Hacker News new | ask | show | jobs
by jamesbressi 4995 days ago
What does it mean when you can't answer the question properly and said "4.5"?
2 comments

You're either a math major or an engineer. We can't do simple math anymore. Please give it to us in the form of an integral.

Also, there's the ambiguity of "inclusive or exclusive? And, which side?"

[1,9], (1,9], [1,9) or (1,9)?

Those ambiguities make no difference to the answer. Answering 4.5 just means you forgot that starting a count from 0 gives a different total than starting from 1.
If you're using the set of integers, then [1,9) is equivalent to [1,8]; and that would have a different answer from 5 for "what the center is"; so, it does affect the answer.
[1,9) is not equivalent to [1,8]. The center of [1,9) is infinitesimally close to the center of [1,9]. Its exactly equal when you take the limit.
... I was using that nomenclature for the short hand of "inclusive/exclusive". 1 to 9 exclusive is 1 to 8 in the integer set. Sorry for the lack of clarity. Perhaps now we can get to my original point?
4.5 is halfway between 0 and 9. Halfway between 1 and 9 is 1+(9-1)/2 = 5
Nu-uh. By that math, halfway between 1 and 2 is.... 1?!

  1+(2-1)/2
  1+(1)/2
  1.5
It only equals 1 if you are using ints ;) I do that more often than I care to admit, I blame programming.
his formula is correct. you made a mistake in the order of operations.