mikeash.com: just this guy, you know?

Posted at 2006-02-21 00:00 | RSS feed (Full text feed) | Blog Index
Next article: NSOpenGLContext and one-shot
Previous article: Braaaaaaaains
Tags: float link numerical
What Every Programmer Should Know
by Mike Ash  

I have a short post for once! I happened to be talking about floating-point comparisons, and I trotted out my usual web page explaining all about floating-point calculation and error. And then I thought, this stuff is so essential, I ought to post it here as well. So without further ado: What Every Computer Scientist Should Know About Floating-Point Arithmetic. A bit heavy on the math, but if you've ever wondered why printing out 10.1 gives you 10.1000002, or why 1.0/10.0 * 5.0 != 1.0/2.0, this will explain it all.

No comments:

Did you enjoy this article? I'm selling whole books full of them! Volumes II and III are now out! They're available as ePub, PDF, print, and on iBooks and Kindle. Click here for more information.

No comments have been posted.

Comments RSS feed for this page

Add your thoughts, post a comment:

Spam and off-topic posts will be deleted without notice. Culprits may be publicly humiliated at my sole discretion.

The Answer to the Ultimate Question of Life, the Universe, and Everything?
Formatting: <i> <b> <blockquote> <code>.
NOTE: Due to an increase in spam, URLs are forbidden! Please provide search terms or fragment your URLs so they don't look like URLs.
Hosted at DigitalOcean.