How to Annoy a Math Major

A friend of mine recently started college. I can’t specifically remember what degree plan he settled on–whether electrical engineering or computer science–but I woke up this morning with a humorous (and very geeky) joke in mind that I would like for him to share with his peers. Now, bear with me, because it was insanely funny to me when I first woke up still groggy from the morning haze. As sanity returned, however, the joke seemed markedly less amusing. Here goes:

Q: How might a CS student annoy a first year math major?
A: 0.1 + 0.2 ≈ 0.3

You might find the statement absurd. After all, it truly seems to make little sense that 0.1 plus 0.2 is approximately equal to 0.3. One-tenth and two-tenths equals three-tens. End of story. Right?

Therein lies the problem that first year math students might not appreciate (and one that hopefully CS students would!): Qualify the number base! In base 10, it’s easy enough to represent certain fractions (think 1/10th, 2/5ths, etc.) in a concise decimal representation such as 0.1 or 0.2. Of course, this breaks down with other fractions like 1/3rd or 2/3rds where the decimal representation would be 0.666666 ad infinitum. Incidentally, this is exactly why in the wonderful world of technology, you really can wind up in a situation where 0.1 + 0.2 isn’t exactly 0.3. Just as 1/3rd cannot be represented in decimal without repetition notation, 0.1 (or 1/10th) is a repeating fraction in binary (0.000110011001100110011001100110011…); thus, once the floating point is converted from its binary representation to a human readable format (rather, converting base 2 to base 10), 1/10th (in binary) would appear as 0.100000000000000005551115123126… and so on.

For further examples and a much better description of why this happens than I can write go here.

Edit: October 18. This post was meant as a jestful commentary on number bases and to highlight unexpected issues that aspiring CS majors may run into as they learn to code. I find it necessary to point this out because I have had some acquaintances with heavy mathematics backgrounds grow infuriated with me because they felt that I gloss over a few glaring points (which is intentional). Amusingly, I don’t think they read the title. :)

No comments.

Firefox Fonts too Light (or blurry)? Here’s a Fix

It’s no secret (or surprise) that Mozilla released Firefox 6 today. Included in this release is, among other things, working WebGL support and numerous fixes. There’s one small, glaring annoyance that some of you on Windows might have noticed:

While that snapshot doesn’t do much justice to the degree that Firefox 6.0’s fonts are most certainly light, other parts of the UI suffer. I’m not precisely sure what the culprit is; it vaguely reminds me of the rather light default font rendering that shipped with WPF in Visual Studio 2008.

Anyway, one possible fix (I’m sure there’s more) dates back some 5 months prior and can be had by entering about:config into a new tab, filtering for gfx and changing the values gfx.direct2d.disabled and gfx.direct2d-force-enabled to true. This might affect performance and possibly introduce breakage, but it works fine under Windows 7. If you’re curious, here’s what the appropriate settings should look like when you’re done:

This solution will probably not work on older versions of Windows that did not use a GPU-accelerated window manager, and I’m not sure how it will behave in Windows 7 with Aero turned off. Be mindful of this. You might break things.

Hope that helps!

1 comment.


Apologies for the downtime, everyone.

I was in the process of updating my server and inadvertently copied over an older instance of MySQL thinking that the one I had actually installed was the older instance. I spotted the problem after about a half hour, but because I had already begun the process of restoring other files, I didn’t have a chance to make the correct update until about an hour ago.

I definitely won’t be doing that again!

No comments.