[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optimization: Replace NaN by Inf
From: |
Christoph Spiel |
Subject: |
Re: Optimization: Replace NaN by Inf |
Date: |
Tue, 7 Aug 2001 14:11:09 +0200 |
User-agent: |
Mutt/1.2.5i |
On Mon, Aug 06, 2001 at 06:14:19PM +0100, Etienne Grossmann wrote:
> when optimizing a function 'f', I am tempted to replace any NaNs
> that it returns by Infs. This way, the returned value can be
> compared w/ other values, and the optimization algorithm is happy.
>
> Can anyone think of a reason not to replace NaNs by Infs inside an
> optimization algorithm?
I would advise against replacing NaNs with Infs, especially if you are
using complex arithmetic.
Usually a NaN indicates that a computation has gone very wrong and the
cause should be investigated. (This is one of the reasons why special
values like NaN have been introduced in the first place.)
-cls
--
Christoph L. Spiel <address@hidden>
Hammersmith Consulting, web: www.hammersmith-consulting.com
Phone: +49-8022-662908, fax: +49-8022-662909
-------------------------------------------------------------
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
-------------------------------------------------------------