help-octave
[Top][All Lists]
Advanced

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

Re: strange problem


From: Paul Kienzle
Subject: Re: strange problem
Date: Wed, 3 Dec 2003 20:30:34 -0500

I'm not a fan of hard-coded constants.  I would use

        x = fix(x/eps)*eps

The following may be more efficient:

        x(abs(x)<eps) = 0

If you prefer relative rather than absolute uncertainty, use:

        x(abs(x)<max(abs(x(:)))*eps) = 0


Paul Kienzle
address@hidden

On Dec 3, 2003, at 5:09 PM, robert Macy wrote:

I would use something like...

x = fix(x*1e16)/1e16;

             - Robert -


On Wed, 03 Dec 2003 13:51:51 -0800
 "Henry F. Mollet" <address@hidden> wrote:
octave:14> x=-0.000000000000000020817
x =  -2.0817e-17
octave:15> fix(x)
ans = 0
Henry


on 11/27/03 11:58 PM, Christoph Dalitz at
address@hidden
wrote:

On Thu, 27 Nov 2003 23:03:26 +0000
Geraint Paul Bevan <address@hidden> wrote:
|
|    -2.0817e-17    1.0000e+02
|    -1.0000e-02    1.0000e+00
|

The number -2.0817e-17 is -0.000000000000000020817,
which is very, very
close to zero.

Is there an Octave function that truncates/rounds such
small numbers to
zero (like the Scilab function "clean")?

I have tried "help round" and "help trunc", but found
nothing appropriate.

Thanks,

Christoph





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


-------------------------------------------------------------




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

-------------------------------------------------------------




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




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