Rounding question

  • jfgoude (1/17/2013)

    rounding float problem ... the only way to know is to try so : 64% of trickering on this QOTD

    I disagree, for several reasons.

    First - if I see this question, know about the possible issues with floating point values in the ROUND function, and then decide that the only way to know the result of this code is to run te code - is that "trickery", or a proof that I understand the relevant concept of this question?

    And even if you do define that as trickery, than the 64% is still not correct. If you assume that nobody can know this, so that everyone who answers the question must either run the code (your definition of "trickery") and hence is sure to get it right, or picks a random answer, then the total amount of correct answers is all from the first group plus one third of the second group (because, with three answer options, there is a 1 in 3 chance of getting it right when doing a random guess). So we know that (coderunners) + (guessers) = 100%, and (coderunner) + (guessers)/3 = 64%. Two equations with two variables - easily solved; we can deduct that based on these assumptions, there must be 54% guessers and hence only 46% coderunners.

    But I would say that even those assumption are wrong. I think there are three groups. Those who run the code, those who guess - and those who first eliminate the obviously wrong answers and then guess between the rest. Having seen a lot of QotD questions already, you can know for certain that this question would never have been asked if both number were rounded up, so you can immediately discarded that option. Both other options are possible, so that gives you a 50% chance of getting it right. Based on these assumptions, we now get these equations: (coderunners) + (blindguessers) + (guessafterelimination) = 100%, and (coderunners) + (blindguessers)/3 + (guessafterelimination)/2 = 64%. Two equations, and three variables - so no way to solve this! The only thing we know for sure is that the number of coderunners has to be between 28% and 46%.

    (And even those assumptions are probably wrong, because there might also be people who have not seen enough QotD's to prevent a reaction like "oh, simple question, I don't see the point but it obviously has to be this one ... WHAT???". But I don't think that this is a very large group.)

    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog:
    SQL Server Execution Plan Reference:

Viewing post 46 (of 45 total)

You must be logged in to reply to this topic. Login to reply