As one who has been vocally critical of Atwood in the past for his lack of CS knowledge, I'll take this opportunity to congratulate him for discovering floating point arithmetic, and recognizing that math is important.
This is a blog that is aimed at programmers, right? Good programmers, that even like their profession enough to read blogs about it. But the entry reads like it is written for some "introduction to computers" blog instead. Surely this is not new or shocking information to any programmer in 2009?
The new Windows calculator calculates 999 999 999 999 999 - 999 999 999 999 998 correctly.
It's not computer problem, it's programming problem, I remember I read an article where SteveBallmer said they have invested a lot in the XP calculator (the last one calculate incorrectly) at that point I didn't understand why they "invested a lot" and remade in from "Scratch".
but now it seems to be fair, calculation needs a lot of programming to get accurate results..
> Computers are awesome, yes, but they aren't infinite.. yet. So any prospects of storing any infinitely repeating number on them are dim at best. The best we can do is work with approximations at varying levels of precision that are "good enough", where "good enough" depends on what you're doing, and how you're doing it. And it's complicated to get right.
This isn't math, this is arithmetic. Computers are actually pretty good as math assistants - I refer to packages such as Maple, Reduce and similar - but what he's talking about is arithmetic. And programming arithmetic can be hard too.
It's like someone you know saying they program, and then you discover they write HTML, and know nothing about PHP, Perl, Python, JavaScript, <insert your favorite language here>. Programmers snort derisively about such sweeping ignorance, and then do the same thing in other fields by calling sums like 399999999999 - 399999999998 "math".
It isn't. Not to those who do, or have done, real math, any more than HTML hacking is "programming", and all "hacking" is breaking into banks and defacing web sites.
If you really care about getting your arithmetic right it's possible, but it's hard. Here's a challenge: write a program that takes three floating point numbers and returns their sum. I'll bet you can't get it right.
You can still store a symbolic representation of those numbers that you can't represent though in limited cases (such as rational division) and write your algorithms so that it doesn't truncate it in the worst possible way.
I feel compelled to mention that you could just use a language with a proper numeric tower.
If the numbers that you input to an algorithm are exact, you get an exact answer. If they are inexact, you get an inexact answer. 399 999 999 999 999 is an exact number.
Another intriguing possibility is to represent all required numbers exactly, even sqrt(2). It is possible with lazy evaluation: essentially a number is represented by a function that computes the digits of its decimal expansion, and arithmetic operations take two functions and return a third. Inefficient but mind-blowing.