Coding Horror: Why Do Computers Suck at Math?
codinghorror.com
codinghorror.com
No. Just no.
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..
Rationals?
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.
GNU multiprecision arithmetic library - http://gmplib.org/ Coq Proof Assistant - http://www.lix.polytechnique.fr/coq/
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.
guile> (- 399999999999 399999999998)
$1 = 1* (- 399999999999999 399999999999998)
1
* (- 12.52 12.51)
0.010000229
* (* 850 77.1)
65535.0