Fox example: 1.2 should be 1 and 1.6 should be 2
Asked
Active
Viewed 247 times
0
-
1possible duplicate of [Rounding numbers in Objective-C](http://stackoverflow.com/questions/752817/rounding-numbers-in-objective-c) – MarkPowell Apr 20 '11 at 12:53
-
No code. Not a very good question. – S.Lott Apr 20 '11 at 12:54
-
@MarkPowell: That other question is for rounding to the nearest 0.5. Similar, but most certainly not identical. – Marcelo Cantos Apr 20 '11 at 12:55
-
@S.Lott: The question seems pretty clear to me. It may warrant some discussion around how to deal with 1.5, but that's probably just down to inexperience. – Marcelo Cantos Apr 20 '11 at 12:57
-
@Marcelo Cantos: Is it really just a "look up the function for me" question? That doesn't seem possible. – S.Lott Apr 20 '11 at 12:58
-
@S.Lott: If you've never worked with floating-point numbers, it might not even be obvious what to search for. If I Google for "rounding numbers", not a single hit on the first page hints that the solution involves `floor()` (or `round()` if you're on C99). "Rounding floating point numbers" gets you closer, but only after a lot of reading. – Marcelo Cantos Apr 20 '11 at 13:03
-
@Marcelo Cantos: So you're saying it really is just a "look up the function for me" question? And you're saying that's a good question to ask? – S.Lott Apr 20 '11 at 13:49
-
@S.Lott: No, I'm saying that looking up the function is far from easy if the obvious search terms don't readily yield any insights. Am I missing something? – Marcelo Cantos Apr 20 '11 at 22:57
-
@Marcelo Cantos: "Am I missing something?" No idea. But I'm still unclear on why this question wasn't closed as being (1) a simple duplicate or (2) not a real question. Folks who have never worked with floating point should explain their lack of background in the question. Folks who can't figure out the search terms really should be using tutorials, not Stack Overflow. – S.Lott Apr 21 '11 at 00:14
-
@S.Lott: (1) this wasn't an exact duplicate of the question referenced by @MarkPowell; if there is a genuine duplicate (and there is probably one somewhere), then you are obviously free to point it out. (2) It may have been poorly phrased (possibly due to the OP's grasp of English), but it was obvious what the question was. What is the point of stating one's background? If you don't know, you don't know. Finally, if noobs have to wring their hands over how long to hunt around before risking a spanking for asking too-simple a question on SO, then this site has probably had its day. – Marcelo Cantos Apr 21 '11 at 06:16
-
@Marcelo Cantos: "What is the point of stating one's background?" to avoid misinterpreting a poor question and providing a useless answer. If you don't know the asker's background, guessing is rather rude. Repeating things they already know doesn't seem helpful to me. The issue is not "how long to hunt around". The issue is that this simply appears to be a remarkably bad question and some effort on the part of the person asking could clarify it. The effort put into clarifying helps everyone. Asker and other askers alike. As well as hopeful answerers. – S.Lott Apr 21 '11 at 10:07
-
@S.Lott: As a generalisation, your point has merit, but in this instance I'd be amazed if anyone was confused to the point of misinterpreting the question — or that knowledge of the OP's background would have made an iota of difference — and the answers seem to back up this sentiment. This also goes to the quality of the question. Whatever it is you dislike about it, no one, AFAICT, had any trouble grokking it, which is ultimately what counts, IMO. – Marcelo Cantos Apr 21 '11 at 12:15
-
@Marcelo Cantos: "no one, AFAICT, had any trouble grokking". Based on the sample size of 2, it appears I'm the only one who found this to be a poor question. The fact that the question--itself--has had zero votes appears to mean nothing. That's helpful. – S.Lott Apr 21 '11 at 12:20