• OK, no testing....

    What does this return?

    select 10 / 3.3

    And this?

    select 10 / 3.33

    You can see a nice (if you like math) progression happening there. But what if you're really bored, and you keep adding 3s? Well, if you go far enough, you get this:

    Server: Msg 8115, Level 16, State 2, Line 1

    Arithmetic overflow error converting expression to data type numeric.

    Fair enough, it would be silly to expect SQL Server to put up with an infinite number of digits. But if you add those threes one-by-one, you'll see some interesting results.

    select 10 / 3.33333333333333333

    returns

    3.0000000000000000030

    select 10 / 3.333333333333333333

    returns

    3.000000000000000000

    So presumably, at this point, we've run out of degrees of accuracy (can't remember the actual term for that, but y'all get the point). But wait, look at the length of the returned values--the new one hasn't just pushed the three out of the visible range, it's actually gotten shorter!

    Let's add another three:

    select 10 / 3.3333333333333333333

    returns

    3.00000000000000000

    It's one character shorter again! And if we keep adding threes, we keep getting shorter and shorter results, all the way until

    select 10 / 3.333333333333333333333333333333

    returns

    3.000000

    And then, of course, we add one more three and are told that our arithmetic has overflowed.

    Total usable value of this experiment: not really much at all. But it was fun.

    Anyone know the intricacies of the math engine well enough to describe what's happening to produce the shorter results? My guess is that it's something quite simple, but I'd be interested to know what the machinations are.

    JeremyNYC