Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

862 questions

981 answers

1.4k comments

431 users

0 votes
I have a question regarding the rounding methods to nearest -infinty and +infinity.

In the lecture videos for the case "nearest -infinity", we say at the corner cases .5 it get rounded down, but the formula is with ⌈x − 0.5⌉. I would interprete this as if you have x=2 then we get such a corner case 1.5. With the positive gauss brackets we are supposed to round up to 2. This would conflict to the video, where we would round down at those corner cases.

For "round to nearest +infinity" its just the other way around.

Did i misunderstand something in the lecture videos or is this a mistake?

Thank you in Advance.
in # Mandatory Modules Bachelor by (410 points)

1 Answer

0 votes

I don't see a mistake in the slides, let's check some examples:

  • ceil(1.0-0.5) = ceil(0.5) = 1.0
  • ceil(1.4-0.5) = ceil(0.9) = 1.0
  • ceil(1.5-0.5) = ceil(1.0) = 1.0
  • ceil(1.6-0.5) = ceil(1.1) = 2.0
  • ceil(2.0-0.5) = ceil(1.5) = 2.0
About cornercases: these are the numbers which are exactly in between two integers like x=1.5 (and not x=2.0). For those numbers n+0.5, we obtain ceil(n+0.5-0.5) = ceil(n) = n which means that we are rounding downwards, right?
by (138k points)

Related questions

+2 votes
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
asked Aug 23, 2020 in # Mandatory Modules Bachelor by least (260 points)
0 votes
1 answer
asked Aug 23, 2020 in # Mandatory Modules Bachelor by VF (120 points)
Imprint | Privacy Policy
...