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: Thu, 27 Nov 2003 23:03:26 +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:

| I get this result
|
| ans =
|
|    -2.0817e-17    1.0000e+02
|    -1.0000e-02    1.0000e+00
|


| so how does this strange number gets up there?
|
| and even better is there a solution because this gives me a unworkable
| solution in the end.
|

The number -2.0817e-17 is -0.000000000000000020817, which is very, very
close to zero. The error is due to the way that numbers are represented
in computers. You can learn more about floating point arithmetic, which
is the cause of the error, in the paper "What Every Computer Scientist
Should Know About Floating Point Arithmetic (1991)" which is available
on line at:

http://citeseer.nj.nec.com/goldberg91what.html

There are some tools available which work to arbitrary precision,
however, if your calculations rely on exact representation, you should
probably change your algorithms - they are not well suited to use on a
digital computer.

- --
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/GgrwACgkQcXV3N50QmNPncgCfTJmoXvIh8PlvZZi7OxMfW56X
OpQAnAvjRi/SZPmeyR8+oHSvUrsZ2xRX
=kUFe
-----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]