I was bored the other day, so I wrote a short story. Enjoy.
The Rise and Fall of Floating Point
A badly-written short story, by Penguinboy
(Warning: this is a work of fiction. Like most fiction, it has a bit of fact within it, but none of the information here is accurate. This story doesn't represent the author's views.)
Chapter 1: Ancient History
When computers were first introduced, all numbers represented within a program were in binary form. The programmers did amazing things with the binary numbers, and the people rejoiced. One day, a bloke by the name of Bob thought, "But I don't count in binary, I count in decimal!". Bob asked the other programmers why they used binary instead of decimal, and the programmers laughed at Bob and called him names (like Snob, Gob, Drongo, etc). Bob wouldn't have any of that, so he shot the mean programmers.
The next day Bob used the power of Morse code to transform all programming languages to use decimal instead of binary formatting. He showed this to a programmer (as there were new ones to replace the others), and the programmer was so shocked to see a '2' in Bob's code, he fainted. Once he recovered, the programmer praised Bob for being such an evolutionary guy, and the people rejoiced. The world flourished under Bob's rule, and programming with regular decimal integers allowed everyone to write their own code.
Many years later, a sheila by the name of Jess was happily programming on her electric keyboard, when suddenly, she saw a problem with the current method of programming with whole integers. She gained an audience with King Bob, and told him her problem.
"I want to use a decimal point in my numbers", Jess told Bob.
Bob thought this was a ridiculous idea. "I think that is a ridiculous idea", he said to Jess, and had her beheaded.
But it was too late. A lone programmer, called Fred, heard Jess's idea, and thought it was not a ridiculous idea at all. He started a cult, which he called "The Jess Initiative" (TJI). He kept TJI a secret from Bob, and started implementing a programming language in secret, because it used illegal binary numbers. Fred had a very good idea of how to use decimal points in his code, which he called "Floating Point". Once he had finished his program, he rejoiced (quietly, and in secret).
Fred approached the King and challenged him to a programming battle, as was the custom. Bob scoffed at Fred, for he was very short, but he accepted the challenge anyway. Once the battle started, it was obvious that Bob had no chance of winning. Fred's program was much more accurate than Bob's, because it had the advantage of decimal precision, where Bob's did not. Bob was killed in the battle, and Fred was crowned the new king. He told the people about floating points, and they rejoiced.
Chapter 2: The Story of John and Gabe
Many years later, A programmer named John Carmack appeared out of nowhere. He astonished all the other programmers with his skill, and quickly became renowned as the best programmer in the land. He gained many followers, and together they named themselves "id". The id group did what nobody else has done before, and made a 3D engine. Early in the development process, the following conversation took place:
"We need a file format to represent a map." Said John to id programmer #1, who we shall call id1.
id1 replied, "Well, our engine only supports maps that are an intersection of planes, so we should represent maps like that."
"Good idea," John said. "Can you make it so that our level editor can edit the map directly, without us having to do any sort of compile process?"
"That'll take me at least a day to implement." Noted id1. "Let's just leave the compile process in there. Nobody will notice the difference."
John thought about it. "You're right. People enjoy compiling, anyway."
The event recorded above is known as "id's First Great Mistake". Many would come to regret the decision, including John himself. But, for now, he and the rest of id rejoiced. The file format was introduced, and was christened with the name "MAP", as id believed their format to be the only format for maps the world would ever need.
As the format was implemented, a few problems quickly arose. The floating point system was producing small, but very important, rounding errors. No program had ever needed to be that accurate before, so the problem had been previously undetected. Carmack knew the consequences of questioning the authority of the floating point system (or face the wrath of Fred), so he quickly eliminated the programmer that found the error, and he covered it up with some basic rounding functions.
id released their 3D engine in the form of a game, and it was called Quake. Quake impressed a lot of people, including one known as Gabe Newell. Gabe approached a programmer friend of his, Mike, and they eloped and formed their own studio, which they called Valve (the name derived from Quake developers' strange fear of the word "Leak", and you can tighten a valve to stop leaking pipes, or something like that). Valve employed the use of the Quake engine to make a game called Half-Life. Half-Life was a very good game, and the people rejoiced.
Gabe decided to make a sequel to Half-Life. He told his Valve friends so, and they all agreed that they should make their own 3D engine, to prove how awesome they were. During development, they discovered that the MAP format was not suitable for their needs:
"We need to make our own format." said Valve programmer #1 (vp1).
"Okay", said Gabe, "Can you make it use the same plane-intersection technique as MAP, though? That way our programmers would already be familiar with the system."
"That makes sense." Replied vp1. "I shall get on it immediately. I could set aside a day to get rid of the compiling process, too, if you want."
"Are you kidding?" asked Gabe. "Level designers love compiling!"
"Wow, what was I thinking? Of course, you're right." said vp1. "You're incredibly smart."
"I know." said Gabe. "Now let's go and frolic in the daffodil fields."
"Do let's." replied vp1.
And go they did.
So Valve continued to use the plane-intersection representation of world geometry in their new format (VMF), and some code from the quake engine was copied over to accommodate for that. Little did they know that the magic floating point rounding algorithm was contained within. Valve later released Half-Life 2 in their new engine called "Source". It was named so because they were unable to copyright "Sauce", because the name was too generic. The reason they wanted "Sauce" is unknown.
Years passed, and John decided to release the Quake source code to the world, for it was no longer of any use to him. The floating point problem was quickly found (which John had forgotten about), and John was sentenced to death by big-rock-dropped-on-head (later known as Crushing) by King Fred. But before he could be executed, a rebellion took place (for the people loved John), and King Fred was overthrown. John refused the people's offer to become the new leader, instead leaving to work on Doom 3 (aka "id's Second Great Mistake"). Fred was eventually replaced by a man called Obama, who relaxed restrictions on programming, so people could code without fear.
Chapter 3: The Fall
Many more years later, a young programmer was doing some research into the story told above. He saw the MAP and VMF formats, and their similarities and differences. He investigated the intersection of planes algorithm, and experienced the same floating point rounding issues that many others before him had encountered. By this time, a programming language had been invented with a "decimal" format.
The decimal format was not a native format, and was therefore slower than floating point. But, it had the advantage of being much more accurate than floating point, having no rounding errors. The young programmer noted this, and used the power of email to eliminate floating point from all the world's programming languages. But the power of email is not as influential as the power of Morse code, so the attempt failed. The young programmer had to make do with modifying his program to use decimals instead of floating points. The program worked much better, and the rounding errors disappeared. The young programmer rejoiced.
Remember the failure of the young programmer. Floating points are fast, easy to manipulate, and native to many CPU's. They cannot be destroyed. Even now, floating points are kidnapping children in their sleep, running over cats for the fun of it, and cutting in line at theme parks. They should be avoided at all costs! If you see a floating point on the street, run away as fast as you can.
You have been warned.