help-octave
[Top][All Lists]
Advanced

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

Re: strange problem


From: Tomer Altman
Subject: Re: strange problem
Date: Thu, 27 Nov 2003 22:14:18 -0800 (PST)

In case you want to know your install's machine precision, type:

> eps

At the Octave prompt. That will let you see the smallest number that
you can represent with the given precision.

Also, try:

> format long

or

> format long e

to get the full representation of the floating point number(s).

HTH,

~Tomer



On Nov 27, 2003 at 11:03pm, Geraint Paul Bevan wrote:

g.beva >Date: Thu, 27 Nov 2003 23:03:26 +0000
g.beva >From: Geraint Paul Bevan <address@hidden>
g.beva >To: Gerald Ebberink <address@hidden>
g.beva >Cc: address@hidden
g.beva >Subject: Re: strange problem
g.beva >Resent-Date: Thu, 27 Nov 2003 16:57:39 -0600
g.beva >Resent-From: address@hidden
g.beva >
g.beva >-----BEGIN PGP SIGNED MESSAGE-----
g.beva >Hash: SHA1
g.beva >
g.beva >Gerald Ebberink wrote:
g.beva >
g.beva >| I get this result
g.beva >|
g.beva >| ans =
g.beva >|
g.beva >|    -2.0817e-17    1.0000e+02
g.beva >|    -1.0000e-02    1.0000e+00
g.beva >|
g.beva >
g.beva >
g.beva >| so how does this strange number gets up there?
g.beva >|
g.beva >| and even better is there a solution because this gives me a unworkable
g.beva >| solution in the end.
g.beva >|
g.beva >
g.beva >The number -2.0817e-17 is -0.000000000000000020817, which is very, very
g.beva >close to zero. The error is due to the way that numbers are represented
g.beva >in computers. You can learn more about floating point arithmetic, which
g.beva >is the cause of the error, in the paper "What Every Computer Scientist
g.beva >Should Know About Floating Point Arithmetic (1991)" which is available
g.beva >on line at:
g.beva >
g.beva >http://citeseer.nj.nec.com/goldberg91what.html
g.beva >
g.beva >There are some tools available which work to arbitrary precision,
g.beva >however, if your calculations rely on exact representation, you should
g.beva >probably change your algorithms - they are not well suited to use on a
g.beva >digital computer.
g.beva >
g.beva >- --
g.beva >Geraint Bevan
g.beva >http://homepage.ntlworld.com/geraint.bevan
g.beva >
g.beva >-----BEGIN PGP SIGNATURE-----
g.beva >Version: GnuPG v1.2.3 (GNU/Linux)
g.beva >Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
g.beva >
g.beva >iEYEARECAAYFAj/GgrwACgkQcXV3N50QmNPncgCfTJmoXvIh8PlvZZi7OxMfW56X
g.beva >OpQAnAvjRi/SZPmeyR8+oHSvUrsZ2xRX
g.beva >=kUFe
g.beva >-----END PGP SIGNATURE-----
g.beva >
g.beva >
g.beva >
g.beva >-------------------------------------------------------------
g.beva >Octave is freely available under the terms of the GNU GPL.
g.beva >
g.beva >Octave's home on the web:  http://www.octave.org
g.beva >How to fund new projects:  http://www.octave.org/funding.html
g.beva >Subscription information:  http://www.octave.org/archive.html
g.beva >-------------------------------------------------------------
g.beva >
g.beva >



-------------------------------------------------------------
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]