I am occasionally asked why I study computer science. The following C bug is what planted the germ for me:
#include <stdio.h>
int main() {
if ((0.1 + 0.1 + 0.1) == 0.3) {
printf("Computers are cool!.\n");
} else {
printf("Computers are weird.\n");
}
return 0;
}
I didn't figure that one out until I discovered that numbers in a computer are not what they seem.
In case you're wondering, I was writing a program to calculate grain yield for homebrewing. Someday I'll put that program up here.