help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange problem


From: Geraint Paul Bevan
Subject: Re: strange problem
Date: Fri, 28 Nov 2003 10:31:39 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gerald Ebberink wrote:
| It is not just representation. This was hust one in a series of 4000
| matrix multiplications in a script. It gave me the problem of a
| impossible answer,a negative distance in a optical system (this is
| possible just not in the system I'm building).
|
| So one of the problems is this number is negative.
|
| Also this problem strikes me as a problem early calculators had.
| you know the 1/3 * 3 =0.99999999 problem.
|
| then there is a third thing I would like to point out.
|
| as you can see in your own example -1/100 = -0.01 and not
| -0.01000000000000000020817 which would give you the 2.0817e-17
|

It's not really the same problem as the calculator "problem". In that
case, 0.9 recurring means 9/9 which is identical to 1. The only problem
there is that the calculator doesn't have a way of showing that the
decimal part is recurring other than just continuing to display the number.

Octave displays values to a certain number of significant figures (5 by
default) so 0.01000000000000000020817 would be displayed as -0.01
anyway. However, the fact that 0 is displayed as 2.0817e-17 does not
mean that every number is represented by itself+2.0817e-17. Some numbers
can be represented exactly in floating point notation. Others are
represented by the closest number that can be.

The real fun starts when you start operating on numbers in ways that
make the noise in their values significant, such as subtracting similar
numbers. That paper by Goldberg explains in more detail. You may also
wish to take a look at "Numerical methods for Scientists and Engineers"
by R.W. Hamming.


- --
Geraint Bevan
http://homepage.ntlworld.com/geraint.bevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAj/HJAoACgkQcXV3N50QmNO+2gCfbdv2acxjkmIMngB2PHTQk9vP
bZYAn3EomG8ZYeUnK93obZ1MTtY2tM8e
=wtK0
-----END PGP SIGNATURE-----



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]