Saluton! * Mike Hall; 2003-08-01, 20:19 UTC: > I agree with Josef that if we were to rewrite our own Bessels > (etc.), we'd want someone who really knows what they are doing. I > re-read 'What Every Computer Scientist Should Know About Floating > Point" last night -- very scarey stuff! :-) There is reason to scare. Even the most trivial computations are nontrivial when one has a closer look at them: 1.upto(16) { |i| puts 1.0 + (0.1 ** i) - 1.0 - (0.1 ** i) } on my machine results in: 8.32667268468867e-17 6.93889390390723e-18 -1.10371781159024e-16 -1.10317571050400e-17 6.55095281406476e-17 -8.22670162108899e-17 5.83866825033984e-17 -6.07747148815308e-17 8.27403705232185e-17 8.27403704456703e-18 8.27403704133586e-19 8.89005823404259e-17 -7.99277837359775e-17 -7.99277837359901e-18 1.10223024625156e-16 -1 e-16 The mathematical results of course all are 0. I did stop at 16 because we have reached what is called 'machine's epsilon'. This value is defined as the largest number that can be added to 1 without changing the value. This means that at this point 1.0 + (0.1 ** i) - 1.0 - (0.1 ** i) becomes equivalent to - (0.1 ** i) Gis, Josef 'Jupp' Schugt -- N'attribuez jamais la malice ce que l'incompñÕence explique ! -- NapolñÐn